diff options
| author | xroneyaa <202318392+xroneyaa@users.noreply.github.com> | 2026-11-24 11:09:18 +0500 |
|---|---|---|
| committer | xroneyaa <202318392+xroneyaa@users.noreply.github.com> | 2026-11-24 11:09:18 +0500 |
| commit | fbbdb0979c0ec88d3b341c8f5b27fd601cd53fa7 (patch) | |
| tree | b644c423932be39f2c3f95b18ba86aa21e6f7cde | |
| parent | 8f481cf16f261c7f37458aeb45e8f4e19994146d (diff) | |
tests: exercise narrow ANSI short-name path on UTF-8 Windows hosts
| -rw-r--r-- | tests/test_native_tool_paths.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_native_tool_paths.py b/tests/test_native_tool_paths.py index 9fc90d10f..2ebd94857 100644 --- a/tests/test_native_tool_paths.py +++ b/tests/test_native_tool_paths.py | |||
| @@ -84,15 +84,21 @@ class NativeFolder(unittest.TestCase): | |||
| 84 | with patch.object(run_gpu_tests.os, "name", "posix"): | 84 | with patch.object(run_gpu_tests.os, "name", "posix"): |
| 85 | self.assertEqual(run_gpu_tests.native_folder("/tmp/work-" + MARK), "/tmp/work-" + MARK) | 85 | self.assertEqual(run_gpu_tests.native_folder("/tmp/work-" + MARK), "/tmp/work-" + MARK) |
| 86 | 86 | ||
| 87 | def test_a_utf8_code_page_keeps_non_ascii_paths(self): | ||
| 88 | with tempfile.TemporaryDirectory() as tmp: | ||
| 89 | work = os.path.join(tmp, "leonida_gpu_work_" + MARK) | ||
| 90 | os.makedirs(work) | ||
| 91 | self.assertEqual(run_gpu_tests.native_folder(work, ansi="utf-8"), work) | ||
| 92 | |||
| 87 | @unittest.skipUnless(os.name == "nt", "8.3 short names are a Windows thing") | 93 | @unittest.skipUnless(os.name == "nt", "8.3 short names are a Windows thing") |
| 88 | def test_a_folder_outside_the_code_page_gets_its_short_name_or_none(self): | 94 | def test_a_folder_outside_the_code_page_gets_its_short_name_or_none(self): |
| 89 | with tempfile.TemporaryDirectory() as tmp: | 95 | with tempfile.TemporaryDirectory() as tmp: |
| 90 | work = os.path.join(tmp, "leonida_gpu_work_" + MARK) | 96 | work = os.path.join(tmp, "leonida_gpu_work_" + MARK) |
| 91 | os.makedirs(work) | 97 | os.makedirs(work) |
| 92 | native = run_gpu_tests.native_folder(work) | 98 | native = run_gpu_tests.native_folder(work, ansi="cp1252") |
| 93 | if native is None: | 99 | if native is None: |
| 94 | self.skipTest("this volume keeps no 8.3 short names (the error path is tested below)") | 100 | self.skipTest("this volume keeps no 8.3 short names (the error path is tested below)") |
| 95 | native.encode("mbcs") # raises if the short name still has a character the code page lacks | 101 | native.encode("cp1252") # raises if the short name still has a character the code page lacks |
| 96 | self.assertNotIn(MARK, native) | 102 | self.assertNotIn(MARK, native) |
| 97 | self.assertTrue(os.path.samefile(native, work)) | 103 | self.assertTrue(os.path.samefile(native, work)) |
| 98 | 104 | ||