8000 bpo-32126: Skip asyncio test when sem_open() is not functional by xdegaye · Pull Request #4559 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-32126: Skip asyncio test when sem_open() is not functional #4559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 26, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update the comment
  • Loading branch information
xdegaye committed Nov 26, 2017
commit 2d505739768ff946b01a7d20ff67e4c9becfffda
4 changes: 3 additions & 1 deletion Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,9 @@ def tearDown(self):
super().tearDown()

def test_get_event_loop_new_process(self):
# Skip the test if the sem_open() implementation is broken.
# Issue bpo-32126: The multiprocessing module used by
# ProcessPoolExecutor is not functional when the
# multiprocessing.synchronize module cannot be imported.
support.import_module('multiprocessing.synchronize')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is very non-obvious.
Don't how to make it more verbose and explicit.
If it's impossible -- I can live with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProcessPoolExecutor uses the multiprocessing (mp) module. The mp module is not functional when the mp.synchronize module cannot be imported and all the mp tests are skipped in that case. So we use here the same idiom used to skip the mp tests (i.e. test.support.import_module('multiprocessing.synchronize')) to skip this test when the platform sem_open implementation is broken or missing.

What about replacing the comment with:

Issue bpo-32126: The multiprocessing module used by ProcessPoolExecutor
is not functional when the multiprocessing.synchronize module cannot be imported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New comment text is perfect!

5307

async def main():
pool = concurrent.futures.ProcessPoolExecutor()
Expand Down
0