test: Ensure Linter is called with correct filename

This commit is contained in:
Paul Gauthier (aider) 2024-08-01 16:58:51 -03:00
parent f696d0933f
commit 2a4b6da1d9

View file

@ -353,8 +353,12 @@ class TestMain(TestCase):
# Run main with --lint option
main(["--lint", "--yes"])
# Check if the Linter was called with the correct file
MockLinter.assert_called_once_with(dirty_file)
# Check if the Linter was called with a filename ending in "dirty_file.py"
# but not ending in "subdir/dirty_file.py"
MockLinter.assert_called_once()
called_arg = MockLinter.call_args[0][0]
self.assertTrue(called_arg.endswith("dirty_file.py"))
self.assertFalse(called_arg.endswith("subdir/dirty_file.py"))
def test_verbose_mode_lists_env_vars(self):
self.create_env_file(".env", "AIDER_DARK_MODE=on")