(tmp_path_factory)
| 19 | |
| 20 | @pytest.fixture(scope="module") |
| 21 | def coord(tmp_path_factory): |
| 22 | tmp_path = tmp_path_factory.mktemp("efb_test") |
| 23 | os.environ['EFB_DATA_PATH'] = str(tmp_path) |
| 24 | config_path = ehforwarderbot.utils.get_config_path() |
| 25 | config = { |
| 26 | "master_channel": "tests.mocks.master.MockMasterChannel", |
| 27 | "slave_channels": ["tests.mocks.slave.MockSlaveChannel"], |
| 28 | "middlewares": ["tests.mocks.middleware.MockMiddleware"] |
| 29 | } |
| 30 | with config_path.open('w') as f: |
| 31 | yaml.dump(config, f) |
| 32 | config = ehforwarderbot.config.load_config() |
| 33 | ehforwarderbot.__main__.init(config) |
| 34 | assert coordinator.master.channel_id == MockMasterChannel.channel_id |
| 35 | assert MockSlaveChannel.channel_id in coordinator.slaves |
| 36 | assert coordinator.middlewares[0].middleware_id == MockMiddleware.middleware_id |
| 37 | |
| 38 | yield coordinator |
| 39 | |
| 40 | coordinator.master = None |
| 41 | coordinator.slaves = {} |
| 42 | coordinator.middlewares = [] |
| 43 | coordinator.master_thread = None |
| 44 | coordinator.slave_threads = {} |
| 45 | |
| 46 | |
| 47 | @pytest.fixture(scope="module") |
nothing calls this directly
no test coverage detected