-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-30357 each test in test_thread waits until all spawned threads finish #1583
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
Conversation
Lib/test/test_thread.py
Outdated
@@ -32,6 +32,11 @@ def setUp(self): | |||
self.created = 0 | |||
self.running = 0 | |||
self.next_ident = 0 | |||
self.thread_count = thread._count() | |||
|
|||
def tearDown(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code looks similar to threading_cleanup(): please use threading_setup() and threading_cleanup() from test.support.
LGTM, but I would prefer to fix experiment this change in the master branch, before touching the super-stable 2.7 branch. Can you propose the same change for the master branch please? |
I was unable to reproduce this issue on the master branch. However still it's worth to clean up tests correctly. I will create new PR for master branch. What you think about rewriting |
You also need to add yourself to Misc/ACKS. You might also document the change in Misc/NEWS. I created #1592 for master where I credited you ;-) |
Well, we are talking about race conditions. It's really hard to reproduce them. It's likely that the test order changed between Python 2.7 and master, but it doesn't mean that master is bugfix. Just that the bug is less likely :-)
Sorry, I wanted to fix quickly the bug, so I pushed a fix based on your work on the master branch and added your name ;-) Can you please try to backport the fix to 2.7? Try to cherry-pick the change from master (or complete this change). |
test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner <[email protected]>
test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner <[email protected]>
LGTM! Thanks for the backport. |
No description provided.