+ def run_tests(self, result):
+ unittest.defaultTestLoader.loadTestsFromName(self.module).run(result)
+
+
+class CythonPyregrTestCase(CythonRunTestCase):
+ def setUp(self):
+ CythonRunTestCase.setUp(self)
+ from Cython.Compiler import Options
+ Options.error_on_unknown_names = False
+
+ def _run_unittest(self, result, *classes):
+ """Run tests from unittest.TestCase-derived classes."""
+ valid_types = (unittest.TestSuite, unittest.TestCase)
+ suite = unittest.TestSuite()
+ for cls in classes:
+ if isinstance(cls, str):
+ if cls in sys.modules:
+ suite.addTest(unittest.findTestCases(sys.modules[cls]))
+ else:
+ raise ValueError("str arguments must be keys in sys.modules")
+ elif isinstance(cls, valid_types):
+ suite.addTest(cls)
+ else:
+ suite.addTest(unittest.makeSuite(cls))
+ suite.run(result)
+
+ def _run_doctest(self, result, module):
+ self.run_doctests(module, result)
+
+ def run_tests(self, result):