diff options
author | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-11-15 16:03:12 (GMT) |
---|---|---|
committer | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-11-15 16:03:12 (GMT) |
commit | d178e69ad859703ae1873f5fc4ac3be357b7f8e4 (patch) | |
tree | 47758661f2a479922a801a6a65679b73e9166526 /Lib/test/support | |
parent | f9cca365c72eaa932f1bee6407fbbbc3b4ed96f0 (diff) | |
parent | 49e8f2d2040d3c15d61a713dcbe14caae41c4f0d (diff) | |
download | cpython-d178e69ad859703ae1873f5fc4ac3be357b7f8e4.zip cpython-d178e69ad859703ae1873f5fc4ac3be357b7f8e4.tar.gz cpython-d178e69ad859703ae1873f5fc4ac3be357b7f8e4.tar.bz2 |
Issue 28668: Merge 3.5
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index d862d8b..8113610 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -90,7 +90,7 @@ __all__ = [ "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", "anticipate_failure", "load_package_tests", "detect_api_mismatch", - "check__all__", "requires_android_level", + "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", # network @@ -1752,6 +1752,22 @@ def impl_detail(msg=None, **guards): msg = msg.format(' or '.join(guardnames)) return unittest.skip(msg) +_have_mp_queue = None +def requires_multiprocessing_queue(test): + """Skip decorator for tests that use multiprocessing.Queue.""" + global _have_mp_queue + if _have_mp_queue is None: + import multiprocessing + # Without a functioning shared semaphore implementation attempts to + # instantiate a Queue will result in an ImportError (issue #3770). + try: + multiprocessing.Queue() + _have_mp_queue = True + except ImportError: + _have_mp_queue = False + msg = "requires a functioning shared semaphore implementation" + return test if _have_mp_queue else unittest.skip(msg)(test) + def _parse_guards(guards): # Returns a tuple ({platform_name: run_me}, default_value) if not guards: |