def setUpClass(cls): # Try to set up python coverage and run without it if not available. cls._cov = None try: import coverage if int(coverage.__version__.split('.')[0]) < 4: cls._cov = None print('Python coverage version >= 4 required.') raise ImportError() cls._cov = coverage.Coverage( source=([os.path.join(TOOLS_ROOT, 'testrunner')]), omit=['*unittest*', '*__init__.py'], ) cls._cov.exclude('raise NotImplementedError') cls._cov.exclude('if __name__ == .__main__.:') cls._cov.exclude('except TestRunnerError:') cls._cov.exclude('except KeyboardInterrupt:') cls._cov.exclude('if options.verbose:') cls._cov.exclude('if verbose:') cls._cov.exclude('pass') cls._cov.exclude('assert False') cls._cov.start() except ImportError: print('Running without python coverage.') sys.path.append(TOOLS_ROOT) global standard_runner from testrunner import standard_runner global num_fuzzer from testrunner import num_fuzzer from testrunner.local import command from testrunner.local import pool command.setup_testing() pool.setup_testing()
def setUpClass(cls): # Try to set up python coverage and run without it if not available. cls._cov = None try: import coverage if int(coverage.__version__.split('.')[0]) < 4: cls._cov = None print 'Python coverage version >= 4 required.' raise ImportError() cls._cov = coverage.Coverage( source=([os.path.join(TOOLS_ROOT, 'testrunner')]), omit=['*unittest*', '*__init__.py'], ) cls._cov.exclude('raise NotImplementedError') cls._cov.exclude('if __name__ == .__main__.:') cls._cov.exclude('except TestRunnerError:') cls._cov.exclude('except KeyboardInterrupt:') cls._cov.exclude('if options.verbose:') cls._cov.exclude('if verbose:') cls._cov.exclude('pass') cls._cov.exclude('assert False') cls._cov.start() except ImportError: print 'Running without python coverage.' sys.path.append(TOOLS_ROOT) global standard_runner from testrunner import standard_runner from testrunner.local import command from testrunner.local import pool command.setup_testing() pool.setup_testing()