def run_all(self): tests = defaultTestLoader.discover(self._path) testRunner = runner.TextTestRunner() result = testRunner.run(tests) sys.exit(not result.wasSuccessful())
def run(self, config, startdir, pattern): if not pattern.endswith('.py'): pattern = 'test_%s.py' % pattern #app = config_from_file(config) app = config_from_file(config, defaults=('test.cfg','base.cfg')) if not startdir: startdir = app.root_path import unittest from unittest import runner testRunner = runner.TextTestRunner() loader = TestLoader() self.test = loader.discover(startdir, top_level_dir=app.root_path +"/..", pattern=pattern) self.result = testRunner.run(self.test) import sys sys.exit()
def tests(): loader = TestLoader() test = loader.discover("tests/") testrunner = runner.TextTestRunner() testrunner.run(test)
def tests_codewars(): loader = TestLoader() test = loader.discover('codewars/tests/') testrunner = runner.TextTestRunner() testrunner.run(test)
def tests(): loader = TestLoader() tests = loader.discover('tests/') testRunner = runner.TextTestRunner() testRunner.run(tests)
def tests(): app.testing = True loader = TestLoader() tests = loader.discover('source/tests/') testRunner = runner.TextTestRunner() testRunner.run(tests)
#!/usr/bin/env python import os import __init__ from unittest import TestLoader, runner this_dir = os.path.dirname(__file__) dirs = ["pagemodel", "addon", "libdict", ] loader = TestLoader() tests = [loader.discover(os.path.join(this_dir, d), top_level_dir=this_dir) for d in dirs] testRunner = runner.TextTestRunner() for test in tests: testRunner.run(test)
def __init__(self, casedir): self.casedir = casedir self.runner = runner.TextTestRunner()