summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-04-16 13:45:35 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-04-16 13:45:35 (GMT)
commit7cf0389138431b8ae442e3c1ed97212a18ada087 (patch)
tree1f6fc8acb76c998e80dbd196ef96dcff4d4ae916
parent5bfe1467f7611da791856da7231c86e2e76f598c (diff)
downloadcpython-7cf0389138431b8ae442e3c1ed97212a18ada087.zip
cpython-7cf0389138431b8ae442e3c1ed97212a18ada087.tar.gz
cpython-7cf0389138431b8ae442e3c1ed97212a18ada087.tar.bz2
Issue #4970: move linuxthreads check outside the affected test, and use skipIf
-rw-r--r--Lib/test/test_os.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index bbeb20e..fe2a228 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -13,6 +13,15 @@ import time
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 @@ class URandomTests(unittest.TestCase):
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)