]> granicus.if.org Git - python/commitdiff
Issue #8605: Skip test_gdb if Python is compiled with optimizations.
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 8 Jul 2010 18:51:30 +0000 (18:51 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 8 Jul 2010 18:51:30 +0000 (18:51 +0000)
Lib/test/test_gdb.py
Misc/NEWS

index e5d1222608ea139c2af8d8ca0ab64c85aba71425..bac8d36c18ee6a89f1afcbab111681d00f3285d5 100644 (file)
@@ -9,6 +9,7 @@ import subprocess
 import sys
 import unittest
 import locale
+import sysconfig
 
 from test.support import run_unittest, findfile
 
@@ -664,6 +665,15 @@ class PyLocalsTests(DebuggerTests):
                                     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")
+
     run_unittest(PrettyPrintTests,
                  PyListTests,
                  StackNavigationTests,
index 9eede9415e5fffce5165ca95fd12d646040896e6..4ec9ec91437ba358fda857962a33dfbc6766249e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1614,6 +1614,8 @@ Documentation
 Tests
 -----
 
+- Issue #8605: Skip test_gdb if Python is compiled with optimizations.
+
 - Issue #7449: Skip test_socketserver if threading support is disabled
 
 - Issue #8672: Add a zlib test ensuring that an incomplete stream can be