mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
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.
This commit is contained in:
parent
192bc7a7be
commit
58fc40427f
@ -565,11 +565,15 @@ class UtilsTests(SimpleTestCase):
|
|||||||
self.assertEqual(normalize_path_patterns(["foo/bar/*", "bar/*/"]), expected)
|
self.assertEqual(normalize_path_patterns(["foo/bar/*", "bar/*/"]), expected)
|
||||||
|
|
||||||
def test_run_formatters_handles_oserror_for_black_path(self):
|
def test_run_formatters_handles_oserror_for_black_path(self):
|
||||||
|
test_files_path = Path(__file__).parent / "test_files"
|
||||||
cases = [
|
cases = [
|
||||||
(FileNotFoundError, "nonexistent"),
|
(
|
||||||
|
FileNotFoundError,
|
||||||
|
str(test_files_path / "nonexistent"),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
OSError if sys.platform == "win32" else PermissionError,
|
OSError if sys.platform == "win32" else PermissionError,
|
||||||
str(Path(__file__).parent / "test_files" / "black"),
|
str(test_files_path / "black"),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
for exception, location in cases:
|
for exception, location in cases:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user