Commit 3be21c3b authored by Mark Florisson's avatar Mark Florisson

Skip debugger tests for pre-2.5 python versions and make them 2.5 compatible

parent c12526e9
import os
from Cython.Debugger import DebugWriter
from Cython.Compiler import CmdLine
from Cython.TestUtils import TransformTest
from Cython.Compiler.ParseTreeTransforms import *
from Cython.Compiler.Nodes import *
from Cython.Debugger.Tests import TestLibCython
class TestNormalizeTree(TransformTest):
def test_parserbehaviour_is_what_we_coded_for(self):
......@@ -144,8 +143,15 @@ class TestWithTransform(object): # (TransformTest): # Disabled!
""", t)
class TestDebugTransform(TestLibCython.DebuggerTestCase):
if sys.version_info[:2] > (2, 4):
from Cython.Debugger import DebugWriter
from Cython.Debugger.Tests.TestLibCython import DebuggerTestCase
else:
# skip test, don't let it inherit unittest.TestCase
DebuggerTestCase = object
class TestDebugTransform(DebuggerTestCase):
def elem_hasattrs(self, elem, attrs):
# we shall supporteth python 2.3 !
......@@ -209,6 +215,9 @@ class TestDebugTransform(TestLibCython.DebuggerTestCase):
raise
if __name__ == "__main__":
import unittest
unittest.main()
from __future__ import with_statement
import os
import re
import sys
......
......@@ -624,6 +624,8 @@ class CythonUnitTestCase(CythonCompileTestCase):
except Exception:
pass
include_debugger = sys.version_info[:2] > (2, 4)
def collect_unittests(path, module_prefix, suite, selectors):
def file_matches(filename):
return filename.startswith("Test") and filename.endswith(".py")
......@@ -632,8 +634,12 @@ def collect_unittests(path, module_prefix, suite, selectors):
return dirname == "Tests"
loader = unittest.TestLoader()
skipped_dirs = []
if include_debugger:
skipped_dirs = []
else:
cython_dir = os.path.dirname(os.path.abspath(__file__))
skipped_dirs = [os.path.join(cython_dir, 'Cython', 'Debugger')]
for dirpath, dirnames, filenames in os.walk(path):
if dirpath != path and "__init__.py" not in filenames:
......@@ -658,12 +664,17 @@ def collect_unittests(path, module_prefix, suite, selectors):
module = getattr(module, x)
suite.addTests([loader.loadTestsFromModule(module)])
def collect_doctests(path, module_prefix, suite, selectors):
def package_matches(dirname):
if dirname == 'Debugger' and not include_debugger:
return False
return dirname not in ("Mac", "Distutils", "Plex")
def file_matches(filename):
filename, ext = os.path.splitext(filename)
blacklist = ('libcython', 'libpython', 'test_libcython_in_gdb')
blacklist = ['libcython', 'libpython', 'test_libcython_in_gdb',
'TestLibCython']
return (ext == '.py' and not
'~' in filename and not
'#' in filename and not
......
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