def build_suite(self, test_labels, extra_tests=None, **kwargs): suite=None if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) else: test_labels = [app for app in settings.INSTALLED_APPS if not app.startswith(settings.TEST_IGNORE_APPS) ] suite = super(AppTestSuiteRunner,self).build_suite(test_labels) suite.addTests(defaultTestLoader.discover('libs')) #for test in defaultTestLoader.discover('libs'): # suite.addTest(test) return reorder_suite(suite, (TestCase,))
def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = None if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) if suite is None: path = os.path.abspath(os.path.join(settings.BASE_PATH, "..")) suite = defaultTestLoader.discover(start_dir=path) if extra_tests: for test in extra_tests: suite.addTest(test) return reorder_suite(suite, (TestCase,))
def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = None discovery_root = settings.TEST_DISCOVERY_ROOT if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) # if single named module has no tests, do discovery within it if not suite.countTestCases() and len(test_labels) == 1: suite = None discovery_root = import_module(test_labels[0]).__path__[0] if suite is None: suite = defaultTestLoader.discover( discovery_root, top_level_dir=settings.CURRENT_DIR, ) if extra_tests: for test in extra_tests: suite.addTest(test) return reorder_suite(suite, (TestCase,))
def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = None discovery_root = settings.TEST_DISCOVERY_ROOT if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) if suite is None: suite = defaultTestLoader.discover( discovery_root, top_level_dir=settings.BASE_PATH, ) if extra_tests: for test in extra_tests: suite.addTest(test) return reorder_suite(suite, (TestCase, ))
def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = None discovery_root = settings.TEST_DISCOVERY_ROOT if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) if not suite.countTestCases() and len(test_labels) == 1: suite = None discovery_root = import_module(test_labels[0]).__path__[0] if suite is None: suite = defaultTestLoader.discover( discovery_root, top_level_dir=settings._PATH, ) if extra_tests: for test in extra_tests: suite.addTest(test) return reorder_suite(suite, (TestCase, ))
def build_suite(self, test_labels, **kwargs): suite = None discovery_root = settings.TEST_DISCOVERY_ROOT # if not test_labels: # test_labels = settings.PROJECT_APPS # that should work, but it doesn't if test_labels: suite = defaultTestLoader.loadTestsFromNames(test_labels) # if single named module has no tests, do discovery within it if not suite.countTestCases() and len(test_labels) == 1: suite = None discovery_root = import_module(test_labels[0]).__path__[0] if suite is None: suite = defaultTestLoader.discover( discovery_root, top_level_dir=settings.BASE_PATH, ) signals.build_suite.send(sender=self, suite=suite) return reorder_suite(suite, (TestCase,))
def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = None discovery_root = settings.TEST_DISCOVERY_ROOT if test_labels: suite = defaultTestLoader.loadTestsFromNames( test_labels) if suite is None: suite = defaultTestLoader.discover( discovery_root, top_level_dir=settings.BASE_PATH, ) if extra_tests: for test in extra_tests: suite.addTest(test) return reorder_suite(suite, (TestCase,))
def collector(): # import __main__ triggers code re-execution __main__ = sys.modules['__main__'] setupDir = os.path.abspath(os.path.dirname(__main__.__file__)) return defaultTestLoader.discover(setupDir)