summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-17 18:58:50 (GMT)
committerGitHub <noreply@github.com>2017-05-17 18:58:50 (GMT)
commitf8d05b3a24e745ab4a974b891ac1389e2f11ce4d (patch)
tree4e131dd471001d21c6f1c705e963e95ea4bf84dd /Lib/test/test_threading.py
parent6f75bc003ab4d5294b0291289ae03f7a8d305f46 (diff)
downloadcpython-f8d05b3a24e745ab4a974b891ac1389e2f11ce4d.zip
cpython-f8d05b3a24e745ab4a974b891ac1389e2f11ce4d.tar.gz
cpython-f8d05b3a24e745ab4a974b891ac1389e2f11ce4d.tar.bz2
bpo-30387: Fix warning in test_threading (#1634)
test_is_alive_after_fork() now joins directly the thread to avoid the following warning added by bpo-30357: Warning -- threading_cleanup() failed to cleanup 0 threads after 2 sec (count: 0, dangling: 21) Use also a different exit code to catch generic exit code 1.
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 5f7c0a8..0f3ac55 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -473,13 +473,15 @@ class ThreadTests(BaseTestCase):
for i in range(20):
t = threading.Thread(target=lambda: None)
t.start()
- self.addCleanup(t.join)
pid = os.fork()
if pid == 0:
- os._exit(1 if t.is_alive() else 0)
+ os._exit(11 if t.is_alive() else 10)
else:
+ t.join()
+
pid, status = os.waitpid(pid, 0)
- self.assertEqual(0, status)
+ self.assertTrue(os.WIFEXITED(status))
+ self.assertEqual(10, os.WEXITSTATUS(status))
def test_main_thread(self):
main = threading.main_thread()