mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
#17249: merge with 3.2.
This commit is contained in:
commit
35246bd5b1
2 changed files with 29 additions and 28 deletions
|
|
@ -326,22 +326,13 @@ class SkipitemTest(unittest.TestCase):
|
||||||
self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords,
|
self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords,
|
||||||
(), {}, b'', [42])
|
(), {}, b'', [42])
|
||||||
|
|
||||||
def test_main():
|
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||||
support.run_unittest(CAPITest, TestPendingCalls,
|
class TestThreadState(unittest.TestCase):
|
||||||
Test6012, EmbeddingTest, SkipitemTest)
|
|
||||||
|
|
||||||
for name in dir(_testcapi):
|
|
||||||
if name.startswith('test_'):
|
|
||||||
test = getattr(_testcapi, name)
|
|
||||||
if support.verbose:
|
|
||||||
print("internal", name)
|
|
||||||
test()
|
|
||||||
|
|
||||||
|
@support.reap_threads
|
||||||
|
def test_thread_state(self):
|
||||||
# some extra thread-state tests driven via _testcapi
|
# some extra thread-state tests driven via _testcapi
|
||||||
def TestThreadState():
|
def target():
|
||||||
if support.verbose:
|
|
||||||
print("auto-thread-state")
|
|
||||||
|
|
||||||
idents = []
|
idents = []
|
||||||
|
|
||||||
def callback():
|
def callback():
|
||||||
|
|
@ -351,17 +342,25 @@ def test_main():
|
||||||
a = b = callback
|
a = b = callback
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# Check our main thread is in the list exactly 3 times.
|
# Check our main thread is in the list exactly 3 times.
|
||||||
if idents.count(threading.get_ident()) != 3:
|
self.assertEqual(idents.count(threading.get_ident()), 3,
|
||||||
raise support.TestFailed(
|
|
||||||
"Couldn't find main thread correctly in the list")
|
"Couldn't find main thread correctly in the list")
|
||||||
|
|
||||||
if threading:
|
target()
|
||||||
import time
|
t = threading.Thread(target=target)
|
||||||
TestThreadState()
|
|
||||||
t = threading.Thread(target=TestThreadState)
|
|
||||||
t.start()
|
t.start()
|
||||||
t.join()
|
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__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
||||||
|
|
@ -620,6 +620,8 @@ Extension Modules
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #17249: convert a test in test_capi to use unittest and reap threads.
|
||||||
|
|
||||||
- Issue #17041: Fix testing when Python is configured with the
|
- Issue #17041: Fix testing when Python is configured with the
|
||||||
--without-doc-strings.
|
--without-doc-strings.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue