def run(self): import unittest # Ensure that build directory is on sys.path (py3k) import sys self.cleanup_environment() self.add_project_to_sys_path() from PyObjCTest.loader import makeTestSuite import PyObjCTools.TestSupport as mod try: meta = self.distribution.metadata name = meta.get_name() test_pkg = name + "_tests" suite = makeTestSuite() runner = unittest.TextTestRunner(verbosity=self.verbosity) result = runner.run(suite) # Print out summary. This is a structured format that # should make it easy to use this information in scripts. summary = dict( count=result.testsRun, fails=len(result.failures), errors=len(result.errors), xfails=len(getattr(result, 'expectedFailures', [])), xpass=len(getattr(result, 'expectedSuccesses', [])), skip=len(getattr(result, 'skipped', [])), ) print("SUMMARY: %s"%(summary,)) finally: self.remove_from_sys_path()
def run(self): verify_platform() be_cmd = self.get_finalized_command("build_ext") import unittest # Ensure that build directory is on sys.path (py3k) import sys self.cleanup_environment() self.add_project_to_sys_path() from PyObjCTest.loader import makeTestSuite import PyObjCTools.TestSupport as mod import warnings warnings.simplefilter("error") try: meta = self.distribution.metadata name = meta.get_name() test_pkg = name + "_tests" suite = makeTestSuite(be_cmd.use_system_libffi) runner = unittest.TextTestRunner(verbosity=self.verbosity) result = runner.run(suite) # Print out summary. This is a structured format that # should make it easy to use this information in scripts. summary = dict( count=result.testsRun, fails=len(result.failures), errors=len(result.errors), xfails=len(getattr(result, "expectedFailures", [])), xpass=len(getattr(result, "expectedSuccesses", [])), skip=len(getattr(result, "skipped", [])), ) print("SUMMARY: %s" % (summary, )) if not result.wasSuccessful(): raise DistutilsError("some tests failed") finally: self.remove_from_sys_path()
def run(self): verify_platform() import unittest # Ensure that build directory is on sys.path (py3k) self.cleanup_environment() self.add_project_to_sys_path() from PyObjCTest.loader import makeTestSuite warnings.simplefilter("error") try: suite = makeTestSuite() runner = unittest.TextTestRunner(verbosity=self.verbosity) result = runner.run(suite) # Print out summary. This is a structured format that # should make it easy to use this information in scripts. summary = { "count": result.testsRun, "fails": len(result.failures), "errors": len(result.errors), "xfails": len(getattr(result, "expectedFailures", [])), "xpass": len(getattr(result, "expectedSuccesses", [])), "skip": len(getattr(result, "skipped", [])), } print("SUMMARY: %s" % (summary, )) if not result.wasSuccessful(): raise DistutilsError("some tests failed") finally: self.remove_from_sys_path()