mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 15:08:38 +00:00
tests: exercise narrow ANSI short-name path on UTF-8 Windows hosts
This commit is contained in:
@ -84,15 +84,21 @@ class NativeFolder(unittest.TestCase):
|
||||
with patch.object(run_gpu_tests.os, "name", "posix"):
|
||||
self.assertEqual(run_gpu_tests.native_folder("/tmp/work-" + MARK), "/tmp/work-" + MARK)
|
||||
|
||||
def test_a_utf8_code_page_keeps_non_ascii_paths(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
work = os.path.join(tmp, "leonida_gpu_work_" + MARK)
|
||||
os.makedirs(work)
|
||||
self.assertEqual(run_gpu_tests.native_folder(work, ansi="utf-8"), work)
|
||||
|
||||
@unittest.skipUnless(os.name == "nt", "8.3 short names are a Windows thing")
|
||||
def test_a_folder_outside_the_code_page_gets_its_short_name_or_none(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
work = os.path.join(tmp, "leonida_gpu_work_" + MARK)
|
||||
os.makedirs(work)
|
||||
native = run_gpu_tests.native_folder(work)
|
||||
native = run_gpu_tests.native_folder(work, ansi="cp1252")
|
||||
if native is None:
|
||||
self.skipTest("this volume keeps no 8.3 short names (the error path is tested below)")
|
||||
native.encode("mbcs") # raises if the short name still has a character the code page lacks
|
||||
native.encode("cp1252") # raises if the short name still has a character the code page lacks
|
||||
self.assertNotIn(MARK, native)
|
||||
self.assertTrue(os.path.samefile(native, work))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user