(self)
| 89 | self._saved_history_path = None |
| 90 | |
| 91 | def __enter__(self): |
| 92 | import src.config as cfg_mod |
| 93 | self._tmp = Path(tempfile.mkdtemp(prefix="advisor_test_")) |
| 94 | # Save and override the module-level config-path constants. |
| 95 | # We can't use patch.object for plain Path constants reliably |
| 96 | # because the writer reads them via the module reference. |
| 97 | self._saved_global_path = cfg_mod.GLOBAL_CONFIG_FILE |
| 98 | self._saved_history_path = cfg_mod.HISTORY_FILE |
| 99 | cfg_mod.GLOBAL_CONFIG_FILE = self._tmp / ".clawcodex" / "config.json" |
| 100 | cfg_mod.HISTORY_FILE = self._tmp / ".clawcodex" / "history.jsonl" |
| 101 | cfg_mod.GLOBAL_CONFIG_DIR = self._tmp / ".clawcodex" |
| 102 | cfg_mod._default_manager = None |
| 103 | |
| 104 | os.environ.pop("CLAUDE_CODE_DISABLE_ADVISOR_TOOL", None) |
| 105 | from src.settings.settings import invalidate_settings_cache |
| 106 | invalidate_settings_cache() |
| 107 | return self |
| 108 | |
| 109 | def __exit__(self, *a): |
| 110 | import src.config as cfg_mod |
nothing calls this directly
no test coverage detected