fix: Test check_gitignore with and without .env file

This commit is contained in:
Paul Gauthier (aider) 2024-12-22 09:51:20 -05:00
parent 8768a8aca6
commit 350df7ca55

View file

@ -140,8 +140,15 @@ class TestMain(TestCase):
self.assertEqual(".aider*", gitignore.read_text().splitlines()[0])
# Test without .env file present
gitignore.write_text("one\ntwo\n")
check_gitignore(cwd, io)
self.assertEqual("one\ntwo\n.aider*\n", gitignore.read_text())
# Test with .env file present
env_file = cwd / ".env"
env_file.touch()
check_gitignore(cwd, io)
self.assertEqual("one\ntwo\n.aider*\n.env\n", gitignore.read_text())
del os.environ["GIT_CONFIG_GLOBAL"]