Isolate the global config + settings read-channel. ``/effort`` persists to ``settings.effort`` via ``set_effort`` (the default ConfigManager → global ``"settings"`` section) and reads it via ``get_settings()`` (a fresh ``ConfigManager(cwd=None)``). To isolate: * point the global c
(tmp_path, monkeypatch)
| 93 | |
| 94 | @pytest.fixture |
| 95 | def isolated_settings(tmp_path, monkeypatch): |
| 96 | """Isolate the global config + settings read-channel. |
| 97 | |
| 98 | ``/effort`` persists to ``settings.effort`` via ``set_effort`` (the default |
| 99 | ConfigManager → global ``"settings"`` section) and reads it via ``get_settings()`` |
| 100 | (a fresh ``ConfigManager(cwd=None)``). To isolate: |
| 101 | * point the global config file at ``tmp_path`` (write + read of the global level); |
| 102 | * give the singleton a fresh manager rooted at ``tmp_path``; |
| 103 | * neutralize ``_find_git_root`` so the cwd=None read in ``get_settings`` finds NO |
| 104 | project/local config (no leakage from the real repo); |
| 105 | * invalidate the (module-global) settings cache before AND after, so neither a |
| 106 | prior test nor this one's writes leak across tests. |
| 107 | """ |
| 108 | monkeypatch.setattr(cfg, "GLOBAL_CONFIG_FILE", tmp_path / "config.json") |
| 109 | monkeypatch.setattr(cfg, "_default_manager", cfg.ConfigManager(cwd=tmp_path)) |
| 110 | monkeypatch.setattr(cfg, "_find_git_root", lambda *a, **k: None) |
| 111 | invalidate_settings_cache() |
| 112 | yield tmp_path |
| 113 | invalidate_settings_cache() |
| 114 | |
| 115 | |
| 116 | def _ctx(tmp_path: Path, *, ui=None): |
nothing calls this directly
no test coverage detected