From 63de4387e7aecaf4195fc5b9423676cb2c9bc96e Mon Sep 17 00:00:00 2001 From: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 11 Sep 2025 07:05:04 +0200 Subject: [PATCH] Fix broken CI on windows (#6143) * Fix `test_dtrace.py` * Fix `test_genericpath.py` * fix `test_ntpath.py` * Fix `test_py_compile.py` * Fix `test_shutil.py` * fix `test_stat.py` * Fix `test_tarfile.py` * Mark failing tests --- Lib/test/test_dtrace.py | 32 ++++++++++++++++++++++++++++++++ Lib/test/test_genericpath.py | 8 ++++++++ Lib/test/test_ntpath.py | 8 ++++++++ Lib/test/test_py_compile.py | 1 - Lib/test/test_shutil.py | 7 +------ Lib/test/test_stat.py | 11 ----------- Lib/test/test_tarfile.py | 3 --- 7 files changed, 49 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py index e1adf8e97..a63978fd1 100644 --- a/Lib/test/test_dtrace.py +++ b/Lib/test/test_dtrace.py @@ -159,11 +159,43 @@ class DTraceNormalTests(TraceTests, unittest.TestCase): backend = DTraceBackend() optimize_python = 0 + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_function_entry_return(self): + return super().test_function_entry_return() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_verify_call_opcodes(self): + return super().test_verify_call_opcodes() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_gc(self): + return super().test_gc() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_line(self): + return super().test_line() + class DTraceOptimizedTests(TraceTests, unittest.TestCase): backend = DTraceBackend() optimize_python = 2 + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_function_entry_return(self): + return super().test_function_entry_return() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_verify_call_opcodes(self): + return super().test_verify_call_opcodes() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_gc(self): + return super().test_gc() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_line(self): + return super().test_line() + class SystemTapNormalTests(TraceTests, unittest.TestCase): backend = SystemTapBackend() diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index 2e28d3cfb..3475c026b 100644 --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -352,6 +352,14 @@ class TestGenericTest(GenericTest, unittest.TestCase): with self.assertRaisesRegex(ValueError, 'embedded null'): func(b'/tmp\x00abcds') + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_samestat_on_symlink(self): + return super().test_samestat_on_symlink() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_samefile_on_symlink(self): + return super().test_samefile_on_symlink() + # Following TestCase is not supposed to be run from test_genericpath. # It is inherited by other test modules (ntpath, posixpath). diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index f2cafd97b..96c20fe89 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -1527,6 +1527,14 @@ class NtCommonTest(test_genericpath.CommonTest, unittest.TestCase): def test_expandvars_nonascii(self): return super().test_expandvars_nonascii() + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_samefile_on_symlink(self): + return super().test_samefile_on_symlink() + + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') + def test_samestat_on_symlink(self): + return super().test_samestat_on_symlink() + class PathLikeTests(NtpathTestCase): diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index 750afc1de..6d10099c6 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -78,7 +78,6 @@ class PyCompileTestsBase: self.assertTrue(os.path.exists(self.pyc_path)) self.assertFalse(os.path.exists(self.cache_path)) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_do_not_overwrite_symlinks(self): # In the face of a cfile argument being a symlink, bail out. # Issue #17222 diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index b64ccb37a..8a426e338 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -196,7 +196,6 @@ class TestRmTree(BaseTest, unittest.TestCase): self.assertIsInstance(victim, bytes) shutil.rmtree(victim) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_rmtree_fails_on_symlink_onerror(self): tmp = self.mkdtemp() @@ -216,7 +215,6 @@ class TestRmTree(BaseTest, unittest.TestCase): self.assertEqual(errors[0][1], link) self.assertIsInstance(errors[0][2][1], OSError) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_rmtree_fails_on_symlink_onexc(self): tmp = self.mkdtemp() @@ -1087,7 +1085,6 @@ class TestCopy(BaseTest, unittest.TestCase): shutil.copymode(src_link, dst_link) self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @unittest.skipUnless(hasattr(os, 'lchmod') or os.name == 'nt', 'requires os.lchmod') @os_helper.skip_unless_symlink def test_copymode_symlink_to_symlink(self): @@ -1317,7 +1314,6 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertTrue(os.path.exists(file2)) self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_copy_symlinks(self): tmp_dir = self.mkdtemp() @@ -1360,7 +1356,6 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertEqual(getattr(file1_stat, 'st_flags'), getattr(file2_stat, 'st_flags')) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_copy2_symlinks(self): tmp_dir = self.mkdtemp() @@ -1445,7 +1440,6 @@ class TestCopy(BaseTest, unittest.TestCase): ### shutil.copyfile - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_copyfile_symlinks(self): tmp_dir = self.mkdtemp() @@ -1483,6 +1477,7 @@ class TestCopy(BaseTest, unittest.TestCase): finally: shutil.rmtree(TESTFN, ignore_errors=True) + @unittest.expectedFailureIfWindows('TODO: RUSTPYTHON') @os_helper.skip_unless_symlink def test_dont_copy_file_onto_symlink_to_itself(self): # bug 851123. diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py index ec4cca452..49013a4bc 100644 --- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -325,21 +325,10 @@ class TestFilemode: class TestFilemodeCStat(TestFilemode, unittest.TestCase): statmod = c_stat - # TODO: RUSTPYTHON - if sys.platform == "win32": - @unittest.expectedFailure - def test_link(self): - super().test_link() class TestFilemodePyStat(TestFilemode, unittest.TestCase): statmod = py_stat - # TODO: RUSTPYTHON - if sys.platform == "win32": - @unittest.expectedFailure - def test_link(self): - super().test_link() - if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 0fed89c77..61929e537 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1276,7 +1276,6 @@ class WriteTest(WriteTestBase, unittest.TestCase): self.assertEqual(tarinfo.name, tarinfo2.name) self.assertEqual(tarinfo.size, 3) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @unittest.skipUnless(hasattr(os, "link"), "Missing hardlink implementation") def test_link_size(self): @@ -1301,7 +1300,6 @@ class WriteTest(WriteTestBase, unittest.TestCase): os_helper.unlink(target) os_helper.unlink(link) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") @os_helper.skip_unless_symlink def test_symlink_size(self): path = os.path.join(TEMPDIR, "symlink") @@ -1849,7 +1847,6 @@ class HardlinkTest(unittest.TestCase): self.assertEqual(tarinfo.type, tarfile.REGTYPE, "add file as regular failed") - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_add_hardlink(self): tarinfo = self.tar.gettarinfo(self.bar) self.assertEqual(tarinfo.type, tarfile.LNKTYPE,