Debugger: Fix backtrace test -- don't check for main()
authorMark Florisson <markflorisson88@gmail.com>
Tue, 25 Jan 2011 21:43:52 +0000 (22:43 +0100)
committerMark Florisson <markflorisson88@gmail.com>
Tue, 25 Jan 2011 21:43:52 +0000 (22:43 +0100)
Cython/Debugger/Tests/test_libcython_in_gdb.py

index 6003be089905b9cc3dfd0c172dc048e4ec94131d..738324efa4326c5c5424e08bffe68f39a39677ba 100644 (file)
@@ -283,21 +283,20 @@ class TestBacktrace(DebugTestCase):
         libcython.parameters.colorize_code.value = False
 
         self.break_and_run('os.path.join("foo", "bar")')
-        result = gdb.execute('cy bt', to_string=True)
-
-        _debug(libpython.execute, libpython._execute, gdb.execute)
-        _debug(gdb.execute('cy list', to_string=True))
-        _debug(repr(result))
 
-        assert re.search(r'\#\d+ *0x.* in spam\(\) at .*codefile\.pyx:22',
-                         result), result
-        assert 'os.path.join("foo", "bar")' in result, result
+        def match_backtrace_output(result):
+            assert re.search(r'\#\d+ *0x.* in spam\(\) at .*codefile\.pyx:22',
+                             result), result
+            assert 'os.path.join("foo", "bar")' in result, result
 
-        gdb.execute("cy step")
+        result = gdb.execute('cy bt', to_string=True)
+        match_backtrace_output(result)
 
-        gdb.execute('cy bt')
         result = gdb.execute('cy bt -a', to_string=True)
-        assert re.search(r'\#0 *0x.* in main\(\)', result), result
+        match_backtrace_output(result)
+
+        # Apparently not everyone has main()
+        # assert re.search(r'\#0 *0x.* in main\(\)', result), result
 
 
 class TestFunctions(DebugTestCase):