From d6027cb2dfd1c087859b400cf488b8549a2d00b9 Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Tue, 18 Jan 2011 20:31:35 +0100 Subject: [PATCH] Fix Python 3 testrunner and give a warning for Python 2 builds without debug symbols --- Cython/Debugger/Tests/TestLibCython.py | 3 ++- Cython/Debugger/Tests/test_libcython_in_gdb.py | 2 +- runtests.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Cython/Debugger/Tests/TestLibCython.py b/Cython/Debugger/Tests/TestLibCython.py index 8bc123a0..436085c1 100644 --- a/Cython/Debugger/Tests/TestLibCython.py +++ b/Cython/Debugger/Tests/TestLibCython.py @@ -197,10 +197,11 @@ class TestAll(GdbDebuggerTestCase): return out, err = self.p.communicate() + err = err.decode('UTF-8') border = '*' * 30 start = '%s v INSIDE GDB v %s' % (border, border) end = '%s ^ INSIDE GDB ^ %s' % (border, border) - errmsg = '\n%s\n%s%s' % (start, err.decode('UTF-8'), end) + errmsg = '\n%s\n%s%s' % (start, err, end) self.assertEquals(0, self.p.wait(), errmsg) sys.stderr.write(err) diff --git a/Cython/Debugger/Tests/test_libcython_in_gdb.py b/Cython/Debugger/Tests/test_libcython_in_gdb.py index b6d29022..79de1858 100644 --- a/Cython/Debugger/Tests/test_libcython_in_gdb.py +++ b/Cython/Debugger/Tests/test_libcython_in_gdb.py @@ -426,7 +426,7 @@ def run_unittest_in_module(modulename): "debugging information. Either compile python with " "-g or get a debug build (configure with --with-pydebug).") warnings.warn(msg) - os._exit(1) + os._exit(0) else: m = __import__(modulename, fromlist=['']) tests = inspect.getmembers(m, inspect.isclass) diff --git a/runtests.py b/runtests.py index 67a06932..0d805bfe 100644 --- a/runtests.py +++ b/runtests.py @@ -78,6 +78,15 @@ VER_DEP_MODULES = { 'run.special_methods_T561_py2']), } +# files that should not be converted to Python 3 code with 2to3 +KEEP_2X_FILES = [ + os.path.join('Cython', 'Debugger', 'Tests', 'test_libcython_in_gdb.py'), + os.path.join('Cython', 'Debugger', 'Tests', 'test_libpython_in_gdb.py'), + os.path.join('Cython', 'Debugger', 'libcython.py'), + os.path.join('Cython', 'Debugger', 'libpython.py'), +] + + INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ] CFLAGS = os.getenv('CFLAGS', '').split() @@ -932,9 +941,14 @@ def refactor_for_py3(distdir, cy3_dir): recursive-exclude Cython * recursive-include Cython *.py *.pyx *.pxd recursive-include Cython/Debugger/Tests * + include runtests.py ''') sys.path.insert(0, cy3_dir) + for keep_2x_file in KEEP_2X_FILES: + destfile = os.path.join(cy3_dir, keep_2x_file) + shutil.copy(keep_2x_file, destfile) + class PendingThreadsError(RuntimeError): pass -- 2.26.2