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.
This commit is contained in:
Victor Stinner 2020-06-18 14:53:19 +02:00 committed by GitHub
parent 2c2a4f3d85
commit ddbeb2f3e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 48 additions and 12 deletions

View file

@ -16,7 +16,8 @@ import sys
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 @@ class BasicTest(BaseTest):
"""
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),