]> granicus.if.org Git - python/commitdiff
bpo-36342: Fix test_multiprocessing in test_venv (GH-12513)
authorxdegaye <xdegaye@gmail.com>
Thu, 30 May 2019 21:42:29 +0000 (23:42 +0200)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 30 May 2019 21:42:29 +0000 (14:42 -0700)
when platform lacks a functioning sem_open implementation

https://bugs.python.org/issue36342

Lib/test/test_venv.py
Misc/NEWS.d/next/Tests/2019-03-23-13-58-49.bpo-36342.q6Quiq.rst [new file with mode: 0644]

index 6822d567e42b58883b68cbeca7629ed46217b2ef..278c68699d8e6092df2eb2252f7b88517ed61664 100644 (file)
@@ -14,7 +14,8 @@ import subprocess
 import sys
 import tempfile
 from test.support import (captured_stdout, captured_stderr, requires_zlib,
-                          can_symlink, EnvironmentVarGuard, rmtree)
+                          can_symlink, EnvironmentVarGuard, rmtree,
+                          import_module)
 import threading
 import unittest
 import venv
@@ -315,6 +316,10 @@ class BasicTest(BaseTest):
         """
         Test that the multiprocessing is able to spawn.
         """
+        # Issue bpo-36342: Instanciation of a Pool object imports the
+        # multiprocessing.synchronize module. Skip the test if this module
+        # cannot be imported.
+        import_module('multiprocessing.synchronize')
         rmtree(self.env_dir)
         self.run_with_capture(venv.create, self.env_dir)
         envpy = os.path.join(os.path.realpath(self.env_dir),
diff --git a/Misc/NEWS.d/next/Tests/2019-03-23-13-58-49.bpo-36342.q6Quiq.rst b/Misc/NEWS.d/next/Tests/2019-03-23-13-58-49.bpo-36342.q6Quiq.rst
new file mode 100644 (file)
index 0000000..a7c9298
--- /dev/null
@@ -0,0 +1 @@
+Fix test_multiprocessing in test_venv if platform lacks functioning sem_open.