Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
abcf558b
Commit
abcf558b
authored
Nov 15, 2016
by
Xavier de Gaye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 28668: Skip tests where instanciation of multiprocessing.Queue
would raise ImportError
parent
d42d752c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
Lib/test/support/__init__.py
Lib/test/support/__init__.py
+17
-0
Lib/test/test_logging.py
Lib/test/test_logging.py
+2
-0
No files found.
Lib/test/support/__init__.py
View file @
abcf558b
...
...
@@ -89,6 +89,7 @@ __all__ = [
"bigmemtest"
,
"bigaddrspacetest"
,
"cpython_only"
,
"get_attribute"
,
"requires_IEEE_754"
,
"skip_unless_xattr"
,
"requires_zlib"
,
"anticipate_failure"
,
"load_package_tests"
,
"detect_api_mismatch"
,
"requires_multiprocessing_queue"
,
# sys
"is_jython"
,
"check_impl_detail"
,
# network
...
...
@@ -1731,6 +1732,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
:
...
...
Lib/test/test_logging.py
View file @
abcf558b
...
...
@@ -3066,6 +3066,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):
...
...
@@ -3082,6 +3083,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment