bpo-40275: Adding threading_helper submodule in test.support (GH-20263)

This commit is contained in:
Hai Shi 2020-05-28 06:10:27 +08:00 committed by GitHub
parent 7d80b35af1
commit e80697d687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 483 additions and 428 deletions

View file

@ -7,7 +7,8 @@ import select
import threading
import time
import unittest
from test.support import TESTFN, run_unittest, reap_threads, cpython_only
from test.support import TESTFN, run_unittest, cpython_only
from test.support import threading_helper
try:
select.poll
@ -175,7 +176,7 @@ class PollTests(unittest.TestCase):
self.assertRaises(OverflowError, pollster.poll, INT_MAX + 1)
self.assertRaises(OverflowError, pollster.poll, UINT_MAX + 1)
@reap_threads
@threading_helper.reap_threads
def test_threaded_poll(self):
r, w = os.pipe()
self.addCleanup(os.close, r)
@ -204,7 +205,7 @@ class PollTests(unittest.TestCase):
t.join()
@unittest.skipUnless(threading, 'Threading required for this test.')
@reap_threads
@threading_helper.reap_threads
def test_poll_blocks_with_negative_ms(self):
for timeout_ms in [None, -1000, -1, -1.0, -0.1, -1e-100]:
# Create two file descriptors. This will be used to unlock