#17249: merge with 3.3.
This commit is contained in:
commit
8a909368b9
|
@ -326,22 +326,13 @@ class SkipitemTest(unittest.TestCase):
|
|||
self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords,
|
||||
(), {}, b'', [42])
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(CAPITest, TestPendingCalls,
|
||||
Test6012, EmbeddingTest, SkipitemTest)
|
||||
|
||||
for name in dir(_testcapi):
|
||||
if name.startswith('test_'):
|
||||
test = getattr(_testcapi, name)
|
||||
if support.verbose:
|
||||
print("internal", name)
|
||||
test()
|
||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||
class TestThreadState(unittest.TestCase):
|
||||
|
||||
@support.reap_threads
|
||||
def test_thread_state(self):
|
||||
# some extra thread-state tests driven via _testcapi
|
||||
def TestThreadState():
|
||||
if support.verbose:
|
||||
print("auto-thread-state")
|
||||
|
||||
def target():
|
||||
idents = []
|
||||
|
||||
def callback():
|
||||
|
@ -351,17 +342,25 @@ def test_main():
|
|||
a = b = callback
|
||||
time.sleep(1)
|
||||
# Check our main thread is in the list exactly 3 times.
|
||||
if idents.count(threading.get_ident()) != 3:
|
||||
raise support.TestFailed(
|
||||
self.assertEqual(idents.count(threading.get_ident()), 3,
|
||||
"Couldn't find main thread correctly in the list")
|
||||
|
||||
if threading:
|
||||
import time
|
||||
TestThreadState()
|
||||
t = threading.Thread(target=TestThreadState)
|
||||
target()
|
||||
t = threading.Thread(target=target)
|
||||
t.start()
|
||||
t.join()
|
||||
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(CAPITest, TestPendingCalls, Test6012,
|
||||
EmbeddingTest, SkipitemTest, TestThreadState)
|
||||
|
||||
for name in dir(_testcapi):
|
||||
if name.startswith('test_'):
|
||||
test = getattr(_testcapi, name)
|
||||
if support.verbose:
|
||||
print("internal", name)
|
||||
test()
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
|
|
|
@ -857,6 +857,8 @@ Extension Modules
|
|||
Tests
|
||||
-----
|
||||
|
||||
- Issue #17249: convert a test in test_capi to use unittest and reap threads.
|
||||
|
||||
- Issue #17107: Test client-side SNI support in urllib.request thanks to
|
||||
the new server-side SNI support in the ssl module. Initial patch by
|
||||
Daniel Black.
|
||||
|
|
Loading…
Reference in New Issue