From: Dag Sverre Seljebotn Date: Wed, 13 Aug 2008 11:41:58 +0000 (+0200) Subject: Added --cython-only switch to runtests.py X-Git-Tag: 0.9.8.1~49^2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1192e11d7c4da0a074453235ae2de247258c89c8;p=cython.git Added --cython-only switch to runtests.py --- diff --git a/runtests.py b/runtests.py index 12a00ad1..2ea5c2a7 100644 --- a/runtests.py +++ b/runtests.py @@ -46,7 +46,7 @@ class ErrorWriter(object): 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 @@ -54,6 +54,7 @@ class TestBuilder(object): 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() @@ -102,21 +103,23 @@ class TestBuilder(object): 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 @@ -124,6 +127,7 @@ class CythonCompileTestCase(unittest.TestCase): self.annotate = annotate self.cleanup_workdir = cleanup_workdir self.cleanup_sharedlibs = cleanup_sharedlibs + self.cythononly = cythononly unittest.TestCase.__init__(self) def shortDescription(self): @@ -247,7 +251,8 @@ class CythonCompileTestCase(unittest.TestCase): 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): @@ -259,7 +264,8 @@ class CythonRunTestCase(CythonCompileTestCase): 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) @@ -370,7 +376,10 @@ if __name__ == '__main__': 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") @@ -433,7 +442,7 @@ if __name__ == '__main__': 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)