From 33d9f46e252096657d3074c57e67a027c3283bd0 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 30 Jul 2024 10:10:37 -0300 Subject: [PATCH] Add unit test to verify cmd_lint calls linter with correct filename --- tests/basic/test_commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index d0677ea7c..cbf2c6aec 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -742,8 +742,10 @@ class TestCommands(TestCase): # Run cmd_lint commands.cmd_lint() - # Check if the linter was called with the dirty file - mock_lint.assert_called_once_with(Path(filename).name) + # Check if the linter was called with a filename string whose Path().name matches the expected filename + mock_lint.assert_called_once() + called_arg = mock_lint.call_args[0][0] + self.assertEqual(Path(called_arg).name, filename) # Verify that the file is still dirty after linting self.assertTrue(repo.is_dirty(filename))