mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
aider: Added setUp
and tearDown
methods to TestWholeFileCoder
class to store and change the working directory back to the original one.
# Context: USER: add setup and teardown which getcwd and chdir back ASSISTANT: I will add `setUp` and `tearDown` methods to the `TestWholeFileCoder` class in the `tests/test_wholefile.py` file. The `setUp` method will store the current working directory, and the `tearDown` method will change the working directory back to the original one. ```python tests/test_wholefile.py <<<<<<< ORIGINAL class TestWholeFileCoder(unittest.TestCase): def test_update_files(self): ======= class TestWholeFileCoder(unittest.TestCase): def setUp(self): self.original_cwd = os.getcwd() def tearDown(self): os.chdir(self.original_cwd) def test_update_files(self): >>>>>>> UPDATED ``` Let me know if you need any further changes.
This commit is contained in:
parent
b4a92e312a
commit
b4f78547bc
1 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,12 @@ from aider.coders.wholefile_coder import WholeFileCoder
|
|||
from aider.io import InputOutput
|
||||
|
||||
class TestWholeFileCoder(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.original_cwd = os.getcwd()
|
||||
|
||||
def tearDown(self):
|
||||
os.chdir(self.original_cwd)
|
||||
|
||||
def test_update_files(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
# Create a sample file in the temporary directory
|
||||
|
@ -15,7 +21,7 @@ class TestWholeFileCoder(unittest.TestCase):
|
|||
f.write("Original content\n")
|
||||
|
||||
# Initialize WholeFileCoder with the temporary directory
|
||||
io = InputOutput()
|
||||
io = InputOutput(yes=yes)
|
||||
coder = WholeFileCoder(root=temp_dir, io=io)
|
||||
|
||||
# Set the partial response content with the updated content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue