"""Suite-wide isolation from the machine's own configuration. `load_config` merges `config/config.local.yaml` next to `config.yaml`, and `dispatcher.cfg` is bound at import time, so without this the whole suite reads whichever overlay this deployment happens to have. That was not hypothetical. With `classifier.mode: local_encoder` in the overlay -- the setting this deployment actually runs -- nine tests failed with assertions like `assert 'local_encoder' == 'local_llm'`: five in test_classifier_backoff, three in test_gaming_mode, one in test_classifier_modes_dispatch. Reproduced both directions on the same tree: overlay absent, 1523 passed; overlay present, 9 failed. A deployment that had configured anything could not run its own tests clean, and the failures looked like real regressions. This must run before anything imports `dispatcher`, which is why it is a module-level statement in conftest rather than a fixture: pytest imports conftest first, and `dispatcher.cfg` is built during the first `import dispatcher` in any test module. A test that genuinely wants overlay-merging behaviour should write its own overlay in a tmp_path and point `base_dir` at it -- see tests/test_admin_provider_readonly.py -- rather than depending on the developer's machine. """ import os os.environ["ROUTER_IGNORE_LOCAL_CONFIG"] = "1" # An admin allowlist edit schedules a real catalog poll a few seconds later: # poller.main() reads its OWN config, opens its own DB and talks to the # network. None of that belongs in a unit test, and the existing allowlist # tests would have started firing it the moment the trigger shipped. # # The scheduling logic itself is still covered -- tests/test_admin_allowlist.py # clears this and substitutes a fake runner, so the debounce is tested without # the side effects. os.environ["ROUTER_DISABLE_BACKGROUND_POLL"] = "1"