Commit ac7a5367 authored by Stefan Behnel's avatar Stefan Behnel

fix Py2.5-isms in test code

parent b320d785
from __future__ import with_statement
import os
import re
......@@ -22,8 +21,12 @@ from Cython.Debugger import Cygdb as cygdb
root = os.path.dirname(os.path.abspath(__file__))
codefile = os.path.join(root, 'codefile')
cfuncs_file = os.path.join(root, 'cfuncs.c')
with open(codefile) as f:
f = open(codefile)
try:
source_to_lineno = dict((line.strip(), i + 1) for i, line in enumerate(f))
finally:
f.close()
# Cython.Distutils.__init__ imports build_ext from build_ext which means we
# can't access the module anymore. Get it from sys.modules instead.
......@@ -205,8 +208,11 @@ class GdbDebuggerTestCase(DebuggerTestCase):
self.gdb_command_file = cygdb.make_command_file(self.tempdir,
prefix_code)
with open(self.gdb_command_file, 'a') as f:
f = open(self.gdb_command_file, 'a')
try:
f.write(code)
finally:
f.close()
args = ['gdb', '-batch', '-x', self.gdb_command_file, '-n', '--args',
sys.executable, '-c', 'import codefile']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment