bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() (GH-20944)
On Linux, skip tests using multiprocessing if the current user cannot
create a file in /dev/shm/ directory. Add the
skip_if_broken_multiprocessing_synchronize() function to the
test.support module.
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index ef6d7bd..d3191ed 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -16,7 +16,8 @@
import tempfile
from test.support import (captured_stdout, captured_stderr, requires_zlib,
can_symlink, EnvironmentVarGuard, rmtree,
- import_module)
+ import_module,
+ skip_if_broken_multiprocessing_synchronize)
import unittest
import venv
from unittest.mock import patch
@@ -357,10 +358,11 @@
"""
Test that the multiprocessing is able to spawn.
"""
- # Issue bpo-36342: Instantiation of a Pool object imports the
+ # bpo-36342: Instantiation of a Pool object imports the
# multiprocessing.synchronize module. Skip the test if this module
# cannot be imported.
- import_module('multiprocessing.synchronize')
+ skip_if_broken_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),