aider/tests/test_main.py
Paul Gauthier 8913eb5066 aider: Removed unused import statement for 'sys' in tests/test_main.py.
# Context:
USER: tests/test_main.py:2:1: F401 'sys' imported but unused
import sys
^

ASSISTANT: To fix the unused import issue, you can remove the import statement for 'sys' in the `tests/test_main.py` file.

```python
tests/test_main.py
<<<<<<< ORIGINAL
import sys
=======
>>>>>>> UPDATED
```
2023-05-17 18:26:43 -07:00

34 lines
1.3 KiB
Python

import os
import tempfile
from unittest import TestCase
from aider.main import main
import subprocess
from prompt_toolkit.input import create_input
from io import StringIO
from prompt_toolkit.output import DummyOutput
class TestMain(TestCase):
def test_main_with_empty_dir_no_files_on_command(self):
with tempfile.TemporaryDirectory() as temp_dir:
os.chdir(temp_dir)
pipe_input = create_input(StringIO(""))
main([], input=pipe_input, output=DummyOutput())
pipe_input.close()
def test_main_with_empty_dir_new_file(self):
with tempfile.TemporaryDirectory() as temp_dir:
os.chdir(temp_dir)
pipe_input = create_input(StringIO(""))
main(["foo.txt"], input=pipe_input, output=DummyOutput())
pipe_input.close()
self.assertTrue(os.path.exists("foo.txt"))
def test_main_with_empty_git_dir_new_file(self):
with tempfile.TemporaryDirectory() as temp_dir:
os.chdir(temp_dir)
subprocess.run(["git", "init"], cwd=temp_dir)
pipe_input = create_input(StringIO(""))
main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
pipe_input.close()
self.assertTrue(os.path.exists("foo.txt"))