Commit 7da74a09 authored by Xavier de Gaye's avatar Xavier de Gaye

Issue 28668: Merge 3.5

parents 88f380eb abcf558b
......@@ -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:
......
......@@ -3124,6 +3124,7 @@ if hasattr(logging.handlers, 'QueueListener'):
self.assertEqual(mock_handle.call_count, 5 * self.repeat,
'correct number of handled log messages')
@support.requires_multiprocessing_queue
@patch.object(logging.handlers.QueueListener, 'handle')
def test_handle_called_with_mp_queue(self, mock_handle):
for i in range(self.repeat):
......@@ -3140,6 +3141,7 @@ if hasattr(logging.handlers, 'QueueListener'):
except queue.Empty:
return []
@support.requires_multiprocessing_queue
def test_no_messages_in_queue_after_stop(self):
"""
Five messages are logged then the QueueListener is stopped. This
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment