mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
wip: Refactor main function to include tests for empty directory with no files and new file creation.
This commit is contained in:
parent
490a6999fb
commit
e500f8e37f
1 changed files with 15 additions and 4 deletions
|
@ -5,9 +5,20 @@ from unittest import TestCase
|
|||
from aider.main import main
|
||||
|
||||
class TestMain(TestCase):
|
||||
def test_main_with_dev_null(self):
|
||||
def test_main_with_empty_dir_no_files_on_command(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
with open(os.devnull, 'r') as dev_null:
|
||||
sys.stdin.close()
|
||||
save_stdin = sys.stdin
|
||||
sys.stdin = dev_null
|
||||
main()
|
||||
sys.stdin = save_stdin
|
||||
|
||||
def test_main_with_empty_dir_new_file(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
os.chdir(temp_dir)
|
||||
with open(os.devnull, 'r') as dev_null:
|
||||
save_stdin = sys.stdin
|
||||
sys.stdin = dev_null
|
||||
main(['foo.txt'])
|
||||
sys.stdin = save_stdin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue