fix: make test_get_rel_fname compatible with Windows

This commit is contained in:
Paul Gauthier (aider) 2024-09-04 14:32:35 -07:00
parent 6152a82513
commit 41e8f4401e

View file

@ -26,10 +26,11 @@ class TestLinter(unittest.TestCase):
self.assertEqual(self.linter.languages["javascript"], "eslint") self.assertEqual(self.linter.languages["javascript"], "eslint")
def test_get_rel_fname(self): def test_get_rel_fname(self):
import os
self.assertEqual(self.linter.get_rel_fname("/test/root/file.py"), "file.py") self.assertEqual(self.linter.get_rel_fname("/test/root/file.py"), "file.py")
self.assertEqual( expected_path = os.path.normpath("../../other/path/file.py")
self.linter.get_rel_fname("/other/path/file.py"), "../../other/path/file.py" actual_path = os.path.normpath(self.linter.get_rel_fname("/other/path/file.py"))
) self.assertEqual(actual_path, expected_path)
@patch("subprocess.Popen") @patch("subprocess.Popen")
def test_run_cmd(self, mock_popen): def test_run_cmd(self, mock_popen):