diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_os.py | 13 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 8 | ||||
-rw-r--r-- | Lib/test/test_threading.py | 12 | ||||
-rw-r--r-- | Lib/test/test_threadsignals.py | 5 |
4 files changed, 15 insertions, 23 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5432412..aa9ff5d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -27,15 +27,10 @@ except ImportError: # and unmaintained) linuxthreads threading library. There's an issue # when combining linuxthreads with a failed execv call: see # http://bugs.python.org/issue4970. -USING_LINUXTHREADS = False -if threading: - info = threading._info() - try: - pthread_version = info['pthread_version'] - except KeyError: - pass - else: - USING_LINUXTHREADS = pthread_version.startswith("linuxthreads") +if hasattr(sys, 'thread_info') and sys.thread_info.version: + USING_LINUXTHREADS = sys.thread_info.version.startswith("linuxthreads") +else: + USING_LINUXTHREADS = False # Tests creating TESTFN class FileTests(unittest.TestCase): diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index e18019c..61b2676 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -474,6 +474,14 @@ class SysModuleTest(unittest.TestCase): if not sys.platform.startswith('win'): self.assertIsInstance(sys.abiflags, str) + @unittest.skipUnless(hasattr(sys, 'thread_info'), + 'Threading required for this test.') + def test_thread_info(self): + info = sys.thread_info + self.assertTrue(len(info), 3) + self.assertIn(info.name, ('nt', 'os2', 'pthread', 'solaris', None)) + self.assertIn(info.lock, ('semaphore', 'mutex+cond', None)) + def test_43581(self): # Can't use sys.stdout, as this is a StringIO object when # the test runs under regrtest. diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index fd63d39..66a04c8 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -719,16 +719,6 @@ 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, @@ -736,7 +726,7 @@ def test_main(): ThreadTests, ThreadJoinOnShutdown, ThreadingExceptionTests, - BarrierTests, MiscTests, + BarrierTests, ) if __name__ == "__main__": diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py index b0bc607..f975a75 100644 --- a/Lib/test/test_threadsignals.py +++ b/Lib/test/test_threadsignals.py @@ -14,9 +14,8 @@ if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': process_pid = os.getpid() signalled_all=thread.allocate_lock() -info = thread.info() -USING_PTHREAD_COND = (info['name'] == 'pthread' - and info['lock_implementation'] == 'mutex+cond') +USING_PTHREAD_COND = (sys.thread_info.name == 'pthread' + and sys.thread_info.lock == 'mutex+cond') def registerSignals(for_usr1, for_usr2, for_alrm): usr1 = signal.signal(signal.SIGUSR1, for_usr1) |