]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)
authorVictor Stinner <vstinner@python.org>
Wed, 27 Sep 2023 15:29:20 +0000 (17:29 +0200)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2023 15:29:20 +0000 (17:29 +0200)
Not only check if src_dir exists, but look also for Lib/os.py
landmark.

Lib/test/test_support.py

index 134ce24484fa28f31a14cfe13b2dbfc1224968ee..e4a246ba3ddd4d74def293bcba979aaeb3138921 100644 (file)
@@ -802,17 +802,25 @@ class TestSupport(unittest.TestCase):
             support.real_max_memuse = old_real_max_memuse
 
     def test_copy_python_src_ignore(self):
+        # Get source directory
         src_dir = sysconfig.get_config_var('abs_srcdir')
         if not src_dir:
             src_dir = sysconfig.get_config_var('srcdir')
         src_dir = os.path.abspath(src_dir)
+
+        # Check that the source code is available
         if not os.path.exists(src_dir):
             self.skipTest(f"cannot access Python source code directory:"
                           f" {src_dir!r}")
+        landmark = os.path.join(src_dir, 'Lib', 'os.py')
+        if not os.path.exists(landmark):
+            self.skipTest(f"cannot access Python source code directory:"
+                          f" {landmark!r} landmark is missing")
 
-        ignored = {'.git', '__pycache__'}
+        # Test support.copy_python_src_ignore()
 
         # Source code directory
+        ignored = {'.git', '__pycache__'}
         names = os.listdir(src_dir)
         self.assertEqual(support.copy_python_src_ignore(src_dir, names),
                          ignored | {'build'})