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

@ -10,6 +10,7 @@ from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from test.support import ALWAYS_EQ
from test.support import threading_helper
from datetime import timedelta
@ -2333,7 +2334,7 @@ class TestFlag(unittest.TestCase):
self.assertEqual(Color.ALL.value, 7)
self.assertEqual(str(Color.BLUE), 'blue')
@support.reap_threads
@threading_helper.reap_threads
def test_unique_composite(self):
# override __eq__ to be identity only
class TestFlag(Flag):
@ -2363,7 +2364,7 @@ class TestFlag(unittest.TestCase):
threading.Thread(target=cycle_enum)
for _ in range(8)
]
with support.start_threads(threads):
with threading_helper.start_threads(threads):
pass
# check that only 248 members were created
self.assertFalse(
@ -2751,7 +2752,7 @@ class TestIntFlag(unittest.TestCase):
self.assertEqual(Color.ALL.value, 7)
self.assertEqual(str(Color.BLUE), 'blue')
@support.reap_threads
@threading_helper.reap_threads
def test_unique_composite(self):
# override __eq__ to be identity only
class TestFlag(IntFlag):
@ -2781,7 +2782,7 @@ class TestIntFlag(unittest.TestCase):
threading.Thread(target=cycle_enum)
for _ in range(8)
]
with support.start_threads(threads):
with threading_helper.start_threads(threads):
pass
# check that only 248 members were created
self.assertFalse(