summaryrefslogtreecommitdiff
path: root/tests/user_commands
diff options
context:
space:
mode:
authorRoel Delos Reyes <roel.delosreyes@finqle.com>2025-06-26 01:26:58 +0800
committernessita <124304+nessita@users.noreply.github.com>2025-07-01 15:24:07 -0300
commit58fc40427f2928190c8d273ceff2121b738e768b (patch)
treec13164eeda5ff98ab852ee8d009d0ec7814dcc44 /tests/user_commands
parent192bc7a7be92e20cc250907fb4083df689715679 (diff)
Fixed #36479 -- Improved how FileNotFoundError is triggered in code formatter tests.
Ensured the test for formatter subprocess FileNotFoundError doesn't rely on platform-specific behavior, improving reliability on macOS and other systems by consistently using pathlib to build test paths.
Diffstat (limited to 'tests/user_commands')
-rw-r--r--tests/user_commands/tests.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index acc338685e..4b03f54564 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -565,11 +565,15 @@ class UtilsTests(SimpleTestCase):
self.assertEqual(normalize_path_patterns(["foo/bar/*", "bar/*/"]), expected)
def test_run_formatters_handles_oserror_for_black_path(self):
+ test_files_path = Path(__file__).parent / "test_files"
cases = [
- (FileNotFoundError, "nonexistent"),
+ (
+ FileNotFoundError,
+ str(test_files_path / "nonexistent"),
+ ),
(
OSError if sys.platform == "win32" else PermissionError,
- str(Path(__file__).parent / "test_files" / "black"),
+ str(test_files_path / "black"),
),
]
for exception, location in cases: