]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-109615: Fix support test_copy_python_src_ignore() on WASM (GH-109970) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 27 Sep 2023 15:58:20 +0000 (08:58 -0700)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2023 15:58:20 +0000 (15:58 +0000)
gh-109615: Fix support test_copy_python_src_ignore() on WASM (GH-109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
(cherry picked from commit cc54bcf17b5b5f7681f52baf3acef75b995fa1fd)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_support.py

index 53220ec04a9c94cd1c2646a22acbb678e40adc1f..2f70f919d4043ffe27f4a9c4dc096076f7afd2e9 100644 (file)
@@ -779,17 +779,25 @@ class TestSupport(unittest.TestCase):
         #self.assertEqual(available, 2)
 
     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'})