diff --git a/tests/test_windows_boot_journal_seed.py b/tests/test_windows_boot_journal_seed.py index 8743b9e12..a6528497f 100644 --- a/tests/test_windows_boot_journal_seed.py +++ b/tests/test_windows_boot_journal_seed.py @@ -84,10 +84,16 @@ class BootJournalSeedTest(unittest.TestCase): self.assertIn("LEONIDA_D3D12", lines, result.stdout + result.stderr) # the script got as far as its env list return lines + def assertSamePath(self, actual, expected): + """Both sides as canonical long paths: either may spell a folder in its 8.3 short form (RUNNER~1).""" + self.assertTrue(actual, "no path printed") + canonical = lambda path: os.path.normcase(os.path.realpath(path)) # realpath gives the final, long name + self.assertEqual(canonical(actual), canonical(expected)) + def test_precompiled_journal_beside_the_runtime_is_the_seed(self): (self.runtime / "pipeline_cache.d").mkdir() lines = self.env_lines() - self.assertEqual(os.path.normcase(lines.get(SEED, "")), os.path.normcase(str(self.runtime / "pipeline_cache.d"))) + self.assertSamePath(lines.get(SEED, ""), str(self.runtime / "pipeline_cache.d")) def test_no_precompiled_journal_no_seed(self): self.assertNotIn(SEED, self.env_lines()) @@ -137,14 +143,13 @@ class BootJournalSeedTest(unittest.TestCase): (self.runtime / "pipeline_cache.d").mkdir() sibling = self.runtime / "pipeline_cache.d-x" lines = self.env_lines(f"LEONIDA_PIPELINE_CACHE_DIR={sibling}") - self.assertEqual(os.path.normcase(lines.get(SEED, "")), os.path.normcase(str(self.runtime / "pipeline_cache.d"))) + self.assertSamePath(lines.get(SEED, ""), str(self.runtime / "pipeline_cache.d")) def test_no_seed_for_a_relative_cache_folder(self): (self.runtime / "pipeline_cache.d").mkdir() lines = self.env_lines("LEONIDA_PIPELINE_CACHE_DIR=relative\\cache", command_in=str(self.tmp)) self.assertNotIn(SEED, lines) - self.assertEqual(os.path.normcase(lines["LEONIDA_PIPELINE_CACHE_DIR"]), - os.path.normcase(str(self.tmp / "relative" / "cache"))) + self.assertSamePath(lines["LEONIDA_PIPELINE_CACHE_DIR"], str(self.tmp / "relative" / "cache")) def test_a_long_path_prefix_names_the_same_folder(self): (self.runtime / "pipeline_cache.d").mkdir() @@ -170,7 +175,7 @@ class BootJournalSeedTest(unittest.TestCase): def test_a_relative_runtime_is_resolved_from_the_shell_location(self): (self.runtime / "pipeline_cache.d").mkdir() lines = self.env_lines(runtime="port\\gta6rt.exe", command_in=str(self.tmp)) - self.assertEqual(os.path.normcase(lines.get(SEED, "")), os.path.normcase(str(self.runtime / "pipeline_cache.d"))) + self.assertSamePath(lines.get(SEED, ""), str(self.runtime / "pipeline_cache.d")) def short_tmp(self): """self.tmp spelled with 8.3 names, as %TEMP% is on the GitHub runner (C:\\Users\\RUNNER~1\\...).""" @@ -183,14 +188,13 @@ class BootJournalSeedTest(unittest.TestCase): (self.runtime / "pipeline_cache.d").mkdir() runtime = os.path.join(self.short_tmp(), "port") lines = self.env_lines(runtime=os.path.join(runtime, "gta6rt.exe")) - self.assertEqual(os.path.normcase(lines.get(SEED, "")), os.path.normcase(os.path.join(runtime, "pipeline_cache.d"))) + self.assertSamePath(lines.get(SEED, ""), os.path.join(runtime, "pipeline_cache.d")) def test_a_relative_runtime_from_a_short_shell_location_gives_the_same_seed(self): (self.runtime / "pipeline_cache.d").mkdir() shell = self.short_tmp() lines = self.env_lines(runtime="port\\gta6rt.exe", command_in=shell) - self.assertEqual(os.path.normcase(lines.get(SEED, "")), - os.path.normcase(os.path.join(shell, "port", "pipeline_cache.d"))) + self.assertSamePath(lines.get(SEED, ""), os.path.join(shell, "port", "pipeline_cache.d")) def test_device_fault_default_leaves_the_journal_names_alone(self): self.assertEqual(self.env_lines().get(DEVICE_FAULT), "2")