Debugger: Don't run test suite if GDB python version < 2.6
authorMark Florisson <markflorisson88@gmail.com>
Mon, 24 Jan 2011 20:45:56 +0000 (21:45 +0100)
committerMark Florisson <markflorisson88@gmail.com>
Mon, 24 Jan 2011 20:45:56 +0000 (21:45 +0100)
Cython/Debugger/Tests/TestLibCython.py

index 68746902667af6a52275c5c0870d26b3177a429f..20da0c582d0047d1f42375dd20bd46d20edb48c6 100644 (file)
@@ -167,14 +167,15 @@ class GdbDebuggerTestCase(DebuggerTestCase):
             p.stdout.close()
 
         if have_gdb:
-            python_version_script = tempfile.NamedTemporaryFile()
-            python_version_script.write('python import sys; print sys.version_info\n')
+            python_version_script = tempfile.NamedTemporaryFile(mode='w+')
+            python_version_script.write(
+                'python import sys; print("%s %s" % sys.version_info[:2])')
             python_version_script.flush()
             p = subprocess.Popen(['gdb', '-batch', '-x', python_version_script.name],
                                  stdout=subprocess.PIPE)
             python_version = p.stdout.read().decode('ascii')
             p.wait()
-            python_version_number = [int(a.strip()) for a in python_version.strip('()').split(',')[:3]]
+            python_version_number = [int(a) for a in python_version.split()]
 
         if have_gdb:
             # Based on Lib/test/test_gdb.py
@@ -184,9 +185,10 @@ class GdbDebuggerTestCase(DebuggerTestCase):
         # Be Python 3 compatible
         if (not have_gdb
             or list(map(int, gdb_version_number)) < [7, 2]
-            or python_version_number < [2, 5]):
+            or python_version_number < [2, 6]):
             self.p = None
-            warnings.warn('Skipping gdb tests, need gdb >= 7.2 with Python >= 2.5')
+            warnings.warn(
+                'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6')
         else:
             self.p = subprocess.Popen(
                 args,