bpo-36342: Fix test_multiprocessing in test_venv (GH-12513) · python/cpython@5437ccc (original) (raw)

Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@
14 14 import sys
15 15 import tempfile
16 16 from test.support import (captured_stdout, captured_stderr, requires_zlib,
17 -can_symlink, EnvironmentVarGuard, rmtree)
17 +can_symlink, EnvironmentVarGuard, rmtree,
18 +import_module)
18 19 import threading
19 20 import unittest
20 21 import venv
@@ -315,6 +316,10 @@ def test_multiprocessing(self):
315 316 """
316 317 Test that the multiprocessing is able to spawn.
317 318 """
319 +# Issue bpo-36342: Instanciation of a Pool object imports the
320 +# multiprocessing.synchronize module. Skip the test if this module
321 +# cannot be imported.
322 +import_module('multiprocessing.synchronize')
318 323 rmtree(self.env_dir)
319 324 self.run_with_capture(venv.create, self.env_dir)
320 325 envpy = os.path.join(os.path.realpath(self.env_dir),