[Python-checkins] r85938 - in python/branches/py3k/Lib/test: regrtest.py support.py test_gdb.py

benjamin.peterson python-checkins at python.org
Fri Oct 29 23:31:36 CEST 2010


Author: benjamin.peterson
Date: Fri Oct 29 23:31:35 2010
New Revision: 85938

Log:
make gdb skip expected

Modified:
   python/branches/py3k/Lib/test/regrtest.py
   python/branches/py3k/Lib/test/support.py
   python/branches/py3k/Lib/test/test_gdb.py

Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Fri Oct 29 23:31:35 2010
@@ -1449,6 +1449,9 @@
             if sys.platform != 'sunos5':
                 self.expected.add('test_nis')
 
+            if support.python_is_optimized():
+                self.expected.add("test_gdb")
+
             self.valid = True
 
     def isvalid(self):

Modified: python/branches/py3k/Lib/test/support.py
==============================================================================
--- python/branches/py3k/Lib/test/support.py	(original)
+++ python/branches/py3k/Lib/test/support.py	Fri Oct 29 23:31:35 2010
@@ -20,6 +20,9 @@
 import subprocess
 import imp
 import time
+import sysconfig
+
+
 try:
     import _thread
 except ImportError:
@@ -885,6 +888,16 @@
     gc.collect()
 
 
+def python_is_optimized():
+    """Find if Python was built with optimizations."""
+    cflags = sysconfig.get_config_vars()['PY_CFLAGS']
+    final_opt = ""
+    for opt in cflags.split():
+        if opt.startswith('-O'):
+            final_opt = opt
+    return final_opt and final_opt != '-O0'
+
+
 #=======================================================================
 # Decorator for running a function in a different locale, correctly resetting
 # it afterwards.

Modified: python/branches/py3k/Lib/test/test_gdb.py
==============================================================================
--- python/branches/py3k/Lib/test/test_gdb.py	(original)
+++ python/branches/py3k/Lib/test/test_gdb.py	Fri Oct 29 23:31:35 2010
@@ -9,9 +9,8 @@
 import sys
 import unittest
 import locale
-import sysconfig
 
-from test.support import run_unittest, findfile
+from test.support import run_unittest, findfile, python_is_optimized
 
 try:
     gdb_version, _ = subprocess.Popen(["gdb", "--version"],
@@ -665,15 +664,8 @@
                                     r".*\na = 1\nb = 2\nc = 3\n.*")
 
 def test_main():
-    cflags = sysconfig.get_config_vars()['PY_CFLAGS']
-    final_opt = ""
-    for opt in cflags.split():
-        if opt.startswith('-O'):
-            final_opt = opt
-    if final_opt and final_opt != '-O0':
-        raise unittest.SkipTest("Python was built with compiler optimizations, "
-                                "tests can't reliably succeed")
-
+    if python_is_optimized():
+        raise unittest.SkipTest("Python was compiled with optimizations")
     run_unittest(PrettyPrintTests,
                  PyListTests,
                  StackNavigationTests,


More information about the Python-checkins mailing list