summaryrefslogtreecommitdiff
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 23:58:51 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 23:58:51 +0200
commit87c4bc18d9591c89d76f68cbd67960d2a1309075 (patch)
tree620966a9b67c9eb1aaf9212f72818c47104ecfd0 /Lib/test/test_threading.py
parent31f0922dfc65b5c2f9ba835392872b5f46115c07 (diff)
downloadcpython-87c4bc18d9591c89d76f68cbd67960d2a1309075.tar.gz
Issue #11223: Add threading._info() function providing informations about the
thread implementation. Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of test_threadsignals if a thread lock is implemented using a POSIX mutex and a POSIX condition variable. A POSIX condition variable cannot be interrupted by a signal (e.g. on Linux, the futex system call is restarted).
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index c107652d26..fd63d39367 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -718,6 +718,17 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
class BarrierTests(lock_tests.BarrierTests):
barriertype = staticmethod(threading.Barrier)
+
+class MiscTests(unittest.TestCase):
+ def test_info(self):
+ info = threading._info()
+ self.assertIn(info['name'],
+ 'nt os2 pthread solaris'.split())
+ if info['name'] == 'pthread':
+ self.assertIn(info['lock_implementation'],
+ ('semaphore', 'mutex+cond'))
+
+
def test_main():
test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
@@ -725,7 +736,7 @@ def test_main():
ThreadTests,
ThreadJoinOnShutdown,
ThreadingExceptionTests,
- BarrierTests
+ BarrierTests, MiscTests,
)
if __name__ == "__main__":