class TestBuilder(object):
def __init__(self, rootdir, workdir, selectors, annotate,
- cleanup_workdir, cleanup_sharedlibs, with_pyregr):
+ cleanup_workdir, cleanup_sharedlibs, with_pyregr, cythononly):
self.rootdir = rootdir
self.workdir = workdir
self.selectors = selectors
self.cleanup_workdir = cleanup_workdir
self.cleanup_sharedlibs = cleanup_sharedlibs
self.with_pyregr = with_pyregr
+ self.cythononly = cythononly
def build_suite(self):
suite = unittest.TestSuite()
path, workdir, module,
annotate=self.annotate,
cleanup_workdir=self.cleanup_workdir,
- cleanup_sharedlibs=self.cleanup_sharedlibs)
+ cleanup_sharedlibs=self.cleanup_sharedlibs,
+ cythononly=self.cythononly)
else:
test = CythonCompileTestCase(
path, workdir, module,
expect_errors=expect_errors,
annotate=self.annotate,
cleanup_workdir=self.cleanup_workdir,
- cleanup_sharedlibs=self.cleanup_sharedlibs)
+ cleanup_sharedlibs=self.cleanup_sharedlibs,
+ cythononly=self.cythononly)
suite.addTest(test)
return suite
class CythonCompileTestCase(unittest.TestCase):
def __init__(self, directory, workdir, module,
expect_errors=False, annotate=False, cleanup_workdir=True,
- cleanup_sharedlibs=True):
+ cleanup_sharedlibs=True, cythononly=False):
self.directory = directory
self.workdir = workdir
self.module = module
self.annotate = annotate
self.cleanup_workdir = cleanup_workdir
self.cleanup_sharedlibs = cleanup_sharedlibs
+ self.cythononly = cythononly
unittest.TestCase.__init__(self)
def shortDescription(self):
unexpected_error = errors[len(expected_errors)]
self.assertEquals(None, unexpected_error)
else:
- self.run_distutils(module, workdir, incdir)
+ if not self.cythononly:
+ self.run_distutils(module, workdir, incdir)
class CythonRunTestCase(CythonCompileTestCase):
def shortDescription(self):
result.startTest(self)
try:
self.runCompileTest()
- doctest.DocTestSuite(self.module).run(result)
+ if not self.cythononly:
+ doctest.DocTestSuite(self.module).run(result)
except Exception:
result.addError(self, sys.exc_info())
result.stopTest(self)
help="do not run the file based tests")
parser.add_option("--no-pyregr", dest="pyregr",
action="store_false", default=True,
- help="do not run the regression tests of CPython in tests/pyregr/")
+ help="do not run the regression tests of CPython in tests/pyregr/")
+ parser.add_option("--cython-only", dest="cythononly",
+ action="store_true", default=False,
+ help="only compile pyx to c, do not run C compiler or run the tests")
parser.add_option("-C", "--coverage", dest="coverage",
action="store_true", default=False,
help="collect source coverage data for the Compiler")
if options.filetests:
filetests = TestBuilder(ROOTDIR, WORKDIR, selectors,
options.annotate_source, options.cleanup_workdir,
- options.cleanup_sharedlibs, options.pyregr)
+ options.cleanup_sharedlibs, options.pyregr, options.cythononly)
test_suite.addTests([filetests.build_suite()])
unittest.TextTestRunner(verbosity=options.verbosity).run(test_suite)