[Python-checkins] r80114 - python/branches/py3k/Lib/test/test_os.py

mark.dickinson python-checkins at python.org
Fri Apr 16 15:45:35 CEST 2010


Author: mark.dickinson
Date: Fri Apr 16 15:45:35 2010
New Revision: 80114

Log:
Issue #4970:  move linuxthreads check outside the affected test, and use skipIf

Modified:
   python/branches/py3k/Lib/test/test_os.py

Modified: python/branches/py3k/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k/Lib/test/test_os.py	(original)
+++ python/branches/py3k/Lib/test/test_os.py	Fri Apr 16 15:45:35 2010
@@ -13,6 +13,15 @@
 import shutil
 from test import support
 
+# Detect whether we're on a Linux system that uses the (now outdated
+# and unmaintained) linuxthreads threading library.  There's an issue
+# when combining linuxthreads with a failed execv call: see
+# http://bugs.python.org/issue4970.
+if "CS_GNU_LIBPTHREAD_VERSION" in os.confstr_names:
+    libpthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")
+    USING_LINUXTHREADS= libpthread.startswith("linuxthreads")
+else:
+    USING_LINUXTHREADS= False
 
 # Tests creating TESTFN
 class FileTests(unittest.TestCase):
@@ -588,17 +597,11 @@
             pass
 
 class ExecTests(unittest.TestCase):
+    @unittest.skipIf(USING_LINUXTHREADS,
+                     "avoid triggering a linuxthreads bug: see issue #4970")
     def test_execvpe_with_bad_program(self):
-        try:
-            # 'linuxthreads-0.10' or 'NPTL 2.10.2'
-            pthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")
-            linuxthreads = pthread.startswith("linuxthreads")
-        except ValueError:
-            linuxthreads = False
-        if linuxthreads:
-            raise unittest.SkipTest(
-                "avoid linuxthreads bug: see issue #4970")
-        self.assertRaises(OSError, os.execvpe, 'no such app-', ['no such app-'], None)
+        self.assertRaises(OSError, os.execvpe, 'no such app-',
+                          ['no such app-'], None)
 
     def test_execvpe_with_bad_arglist(self):
         self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)


More information about the Python-checkins mailing list