diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-05 20:18:19 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-05 20:18:19 +0200 |
commit | feeeefa3ecb90502a8a51e0e1132e71d9efcd968 (patch) | |
tree | d07ab307ced5a39f3295d0a12d018750e50107b7 /Lib/test/test_threading.py | |
parent | 7777a1ae8a383004eeea2eeb4519534e82a2e65c (diff) | |
parent | f817d6e6b3530d62e3aca24063e2257542915c42 (diff) | |
download | cpython-feeeefa3ecb90502a8a51e0e1132e71d9efcd968.tar.gz |
Merge: Use shared testing facilities in test_threading
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 04c3598cba..2dc77733f7 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -406,6 +406,14 @@ class ThreadTests(BaseTestCase): t.daemon = True self.assertTrue('daemon' in repr(t)) + def test_deamon_param(self): + t = threading.Thread() + self.assertFalse(t.daemon) + t = threading.Thread(daemon=False) + self.assertFalse(t.daemon) + t = threading.Thread(daemon=True) + self.assertTrue(t.daemon) + class ThreadJoinOnShutdown(BaseTestCase): @@ -691,6 +699,10 @@ class ThreadingExceptionTests(BaseTestCase): thread.start() self.assertRaises(RuntimeError, setattr, thread, "daemon", True) + def test_releasing_unacquired_lock(self): + lock = threading.Lock() + self.assertRaises(RuntimeError, lock.release) + class LockTests(lock_tests.LockTests): locktype = staticmethod(threading.Lock) @@ -720,6 +732,7 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests): class BarrierTests(lock_tests.BarrierTests): barriertype = staticmethod(threading.Barrier) + def test_main(): test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests, ConditionAsRLockTests, ConditionTests, @@ -727,7 +740,7 @@ def test_main(): ThreadTests, ThreadJoinOnShutdown, ThreadingExceptionTests, - BarrierTests + BarrierTests, ) if __name__ == "__main__": |