FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-71052: Enable test_concurrent_futures on platforms that support threading but not multiprocessing by mhsmith · Pull Request #115917 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (5) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 0 additions & 2 deletions Lib/multiprocessing/queues.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

from queue import Empty, Full

import _multiprocessing

from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
Expand Down
16 changes: 0 additions & 16 deletions Lib/test/test___all__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
import sys
import types

try:
import _multiprocessing
except ModuleNotFoundError:
_multiprocessing = None


if support.check_sanitizer(address=True, memory=True):
SKIP_MODULES = frozenset((
Expand All @@ -36,17 +31,6 @@ class FailedImport(RuntimeError):

class AllTest(unittest.TestCase):

def setUp(self):
# concurrent.futures uses a __getattr__ hook. Its __all__ triggers
# import of a submodule, which fails when _multiprocessing is not
# available.
if _multiprocessing is None:
sys.modules["_multiprocessing"] = types.ModuleType("_multiprocessing")

def tearDown(self):
if _multiprocessing is None:
sys.modules.pop("_multiprocessing")

def check_all(self, modname):
names = {}
with warnings_helper.check_warnings(
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_concurrent_futures/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from test import support
from test.support import import_helper

# Skip tests if _multiprocessing wasn't built.
import_helper.import_module('_multiprocessing')

if support.check_sanitizer(address=True, memory=True):
# gh-90791: Skip the test because it is too slow when Python is built
Expand Down
7 changes: 7 additions & 0 deletions Lib/test/test_concurrent_futures/test_init.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import unittest
import sys
from concurrent.futures._base import BrokenExecutor
from concurrent.futures.process import _check_system_limits

from logging.handlers import QueueHandler

from test import support
Expand Down Expand Up @@ -117,6 +119,11 @@ class FailingInitializerResourcesTest(unittest.TestCase):
"""

def _test(self, test_class):
try:
_check_system_limits()
except NotImplementedError:
self.skipTest("ProcessPoolExecutor unavailable on this system")

runner = unittest.TextTestRunner()
runner.run(test_class('test_initializer'))

Expand Down
8 changes: 7 additions & 1 deletion Lib/test/test_concurrent_futures/util.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def strip_mixin(name):


def setup_module():
unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)
try:
_check_system_limits()
except NotImplementedError:
pass
else:
unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)

thread_info = threading_helper.threading_setup()
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Enable ``test_concurrent_futures`` on platforms that support threading but not
multiprocessing.

Back | FazBrowse Home | New Git URL