Add test to reproduce linting failure on windows

This commit is contained in:
Titusz Pan 2025-04-23 14:18:23 +02:00
parent 6df2c1595f
commit 5251a2452c
No known key found for this signature in database
GPG key ID: 4793D770C7B5E1D4

View file

@ -1,3 +1,4 @@
import os
import unittest import unittest
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
@ -36,6 +37,15 @@ class TestLinter(unittest.TestCase):
result = self.linter.run_cmd("test_cmd", "test_file.py", "code") result = self.linter.run_cmd("test_cmd", "test_file.py", "code")
self.assertIsNone(result) self.assertIsNone(result)
def test_run_cmd_win(self):
if os.name != "nt":
self.skipTest("This test only runs on Windows")
from pathlib import Path
root = Path(__file__).parent.parent.parent.absolute().as_posix()
linter = Linter(encoding="utf-8", root=root)
result = linter.run_cmd("dir", "tests/basic", "code")
self.assertIsNone(result)
@patch("subprocess.Popen") @patch("subprocess.Popen")
def test_run_cmd_with_errors(self, mock_popen): def test_run_cmd_with_errors(self, mock_popen):
mock_process = MagicMock() mock_process = MagicMock()