summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 956672d..eabd7f4 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -84,11 +84,24 @@ class ThreadTests(unittest.TestCase):
t.join(NUMTASKS)
self.assert_(not t.is_alive())
self.failIfEqual(t.ident, 0)
+ self.assertFalse(t.ident is None)
self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
if verbose:
print('all tasks done')
self.assertEqual(numrunning.get(), 0)
+ def test_ident_of_no_threading_threads(self):
+ # The ident still must work for the main thread and dummy threads.
+ self.assertFalse(threading.currentThread().ident is None)
+ def f():
+ ident.append(threading.currentThread().ident)
+ done.set()
+ done = threading.Event()
+ ident = []
+ _thread.start_new_thread(f, ())
+ done.wait()
+ self.assertFalse(ident[0] is None)
+
# run with a small(ish) thread stack size (256kB)
def test_various_ops_small_stack(self):
if verbose:
@@ -187,7 +200,8 @@ class ThreadTests(unittest.TestCase):
# Now raise an exception in the worker thread.
if verbose:
print(" waiting for worker thread to get started")
- worker_started.wait()
+ ret = worker_started.wait()
+ self.assertTrue(ret)
if verbose:
print(" verifying worker hasn't exited")
self.assert_(not t.finished)