mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
![]() # Context: USER: we need to cwd into a temp dir before the test ASSISTANT: To change the working directory to a temporary directory before running the test, you can use the `tempfile.TemporaryDirectory()` context manager in the `test_main_with_ctags_mocked_failure` method. Here's the updated code for `tests/test_main.py`: ```python tests/test_main.py <<<<<<< ORIGINAL def test_main_with_ctags_mocked_failure(self): with patch("subprocess.run", side_effect=subprocess.CalledProcessError(1, "ctags")): with patch("aider.main.Coder") as MockCoder: main(["--ctags"]) _, kwargs = MockCoder.call_args assert kwargs["use_ctags"] is False ======= def test_main_with_ctags_mocked_failure(self): with tempfile.TemporaryDirectory() as temp_dir: os.chdir(temp_dir) with patch("subprocess.run", side_effect=subprocess.CalledProcessError(1, "ctags")): with patch("aider.main.Coder") as MockCoder: main(["--ctags"]) _, kwargs = MockCoder.call_args assert kwargs["use_ctags"] is False >>>>>>> UPDATED ``` This change will ensure that the test is run within a temporary directory. |
||
---|---|---|
.. | ||
__init__.py | ||
test_coder.py | ||
test_commands.py | ||
test_io.py | ||
test_main.py | ||
test_repomap.py | ||
test_utils.py |