django.test.utils.get_runner - python examples

Here are the examples of the python api django.test.utils.get_runner taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

56 Examples 7

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : Xavier-Lam
def main():
    os.environ["DJANGO_SETTINGS_MODULE"] = "wechat_django.tests.settings"
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(["wechat_django", "wechat_django.pay"])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : jmfederico
def run_tests(*test_args):
    """Prepare Django environment and run tests."""
    if not test_args:
        test_args = ['tests']

    sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/tests/apps')
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : run.py
Copyright Mozilla Public License 2.0
Author : danpoland
def runtests():
    if django.VERSION >= (1, 7, 0):
        django.setup()

    test_runner = get_runner(settings)
    failures = test_runner(interactive=False, failfast=False).run_tests([])
    sys.exit(failures)

3 View Complete Implementation : manager.py
Copyright MIT License
Author : sophilabs
    @clastmethod
    def patch_runner(cls):
        # FIXME: this is incompatible with --parallel and --test-runner
        # command arguments
        test_runner = get_runner(settings)

        if (not hasattr(test_runner, 'setup_test_environment') or not
                hasattr(test_runner, 'teardown_test_environment')):
            return

        test_runner.setup_test_environment = cls.wrap_setup_test_environment(
            test_runner.setup_test_environment
        )
        test_runner.teardown_test_environment = \
            cls.wrap_teardown_test_environment(
                test_runner.teardown_test_environment
            )

3 View Complete Implementation : runtests.py
Copyright GNU Lesser General Public License v3.0
Author : math-a3k
def run_tests(*test_args):
    if not test_args:
        test_args = ['tests']

    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    os.environ['DJANGO_TEST'] = 'True'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : godaddy
def runtests():
    logging.disable(logging.CRITICAL)
    os.environ['DJANGO_SETTINGS_MODULE'] = 'testapp.settings'
    django.setup()
    TestRunner = get_runner(settings)  # NOQA: N806
    test_runner = TestRunner()
    failures = test_runner.run_tests(["testapp"])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : JamesRamm
def run_tests(*test_args):
    if not test_args:
        test_args = []

    os.environ['DJANGO_SETTINGS_MODULE'] = 'longclaw.tests.settings'
    django.setup()
    test_runner = get_runner(settings)()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : androiz
def run_tests(*test_args):
    if not test_args:
        test_args = ['tests']

    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : kogan
def run_tests():
    # First configure settings, then call django.setup() to initialise
    from django.conf import settings

    settings.configure(**SETTINGS_DICT)
    import django

    django.setup()

    # Now create the test runner
    from django.test.utils import get_runner

    TestRunner = get_runner(settings)

    # And then we run tests and return the results.
    test_runner = TestRunner(verbosity=2, interactive=True)
    failures = test_runner.run_tests(["tests"])
    sys.exit(failures)

3 View Complete Implementation : test.py
Copyright Apache License 2.0
Author : drexly
    def handle(self, *test_labels, **options):
        from django.conf import settings
        from django.test.utils import get_runner

        TestRunner = get_runner(settings, options.get('testrunner'))

        if options.get('liveserver') is not None:
            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options['liveserver']
            del options['liveserver']

        test_runner = TestRunner(**options)
        failures = test_runner.run_tests(test_labels)

        if failures:
            sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : pyconsk
def run_tests(*test_args):
    if not test_args:
        test_args = ['konfera.tests', 'payments.tests']

    # Run tests
    TestRunner = get_runner(settings)
    test_runner = TestRunner()

    failures = test_runner.run_tests(test_args)

    if failures:
        sys.exit(bool(failures))

3 View Complete Implementation : testrunner.py
Copyright MIT License
Author : nickromano
def runtests():
    TestRunner = get_runner(settings)  # noqa
    test_runner = TestRunner(verbosity=1, interactive=True)
    if hasattr(django, 'setup'):
        django.setup()
    failures = test_runner.run_tests(['product_release_notes'])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : fabiocaccamo
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : Tivix
def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    if hasattr(django, 'setup'):
        django.setup()
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))

3 View Complete Implementation : test.py
Copyright MIT License
Author : bpgc-cte
    def handle(self, *test_labels, **options):
        from django.conf import settings
        from django.test.utils import get_runner

        TestRunner = get_runner(settings, options['testrunner'])

        test_runner = TestRunner(**options)
        failures = test_runner.run_tests(test_labels)

        if failures:
            sys.exit(1)

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : yezyilomo
def runtests(*test_args):
    if not test_args:
        test_args = ['tests']

    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    test_runner = get_runner(settings)()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : test.py
Copyright GNU General Public License v2.0
Author : blackye
    def create_parser(self, prog_name, subcommand):
        test_runner_clast = get_runner(settings, self.test_runner)
        options = self.option_list + getattr(
            test_runner_clast, 'option_list', ())
        return OptionParser(prog=prog_name,
                            usage=self.usage(subcommand),
                            version=self.get_version(),
                            option_list=options)

3 View Complete Implementation : runtests.py
Copyright GNU General Public License v3.0
Author : jimmy201602
def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    if hasattr(django, 'setup'):
        django.setup()
    failures = test_runner.run_tests(['django_admin'])
    sys.exit(bool(failures))

3 View Complete Implementation : test.py
Copyright GNU General Public License v2.0
Author : blackye
    def handle(self, *test_labels, **options):
        from django.conf import settings
        from django.test.utils import get_runner

        TestRunner = get_runner(settings, options.get('testrunner'))
        options['verbosity'] = int(options.get('verbosity'))

        if options.get('liveserver') is not None:
            os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options['liveserver']
            del options['liveserver']

        test_runner = TestRunner(**options)
        failures = test_runner.run_tests(test_labels)

        if failures:
            sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : Kemaweyan
def runtests():
    django.setup()
    TestRunner = get_runner(settings)
    runner = TestRunner(verbosity=1, interactive=True)
    failures = runner.run_tests(['content_gallery'])
    sys.exit(failures)

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : dbrgn
def run_tests(*test_args):
    if not test_args:
        test_args = ['tests']

    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    test_runner = get_runner(settings)()
    failures = test_runner.run_tests(test_args)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : linuxsoftware
def runDjangoTest():
    cleanMedia()
    verbosity = 1
    if "-v" in sys.argv or "--verbose" in sys.argv:
        verbosity = 2
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner(top_level="ls/joyous",
                             verbosity=verbosity,
                             keepdb=False)
    labels = ["ls.joyous.tests."+arg for arg in sys.argv[1:]
              if not arg.startswith("-")]
    if not labels:
        labels = ["ls.joyous.tests"]
    failures = test_runner.run_tests(labels)
    return failures

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : abarto
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'uncertainty.tests.settings'
    django.setup()
    sys.path.insert(0, os.path.dirname(__file__))
    test_runner = get_runner(settings)()
    failures = test_runner.run_tests([], verbosity=1, interactive=True)
    sys.exit(bool(failures))

3 View Complete Implementation : setup.py
Copyright MIT License
Author : naritotakizawa
    def run_tests(self):
        #import here, cause outside the eggs aren't loaded
        import django
        from django.conf import settings
        from django.test.utils import get_runner
        os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
        django.setup()
        TestRunner = get_runner(settings)
        test_runner = TestRunner()
        failures = test_runner.run_tests(['tests'])
        sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright GNU General Public License v2.0
Author : edigiacomo
def runtests(test_labels=["tests"]):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(test_labels)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright ISC License
Author : pawamoy
def run_tests(*test_args):
    """Discover and run tests."""
    if not test_args:
        test_args = ['tests']

    # Run tests
    runner = get_runner(settings)
    test_runner = runner()

    failures = test_runner.run_tests(test_args)

    if failures:
        sys.exit(bool(failures))

3 View Complete Implementation : test_runner.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : PaesslerAG
def integrate_into_django_test_runner():
    utils.get_runner = get_runner_with_djpt_mixin
    DjptTestRunnerMixin.collectors = {}
    DjptTestRunnerMixin.limits = {}
    collector_ids = [
        'test method', 'test setUp', 'test tearDown',
        'test setUpClast', 'test tearDownClast',
    ]
    for collector_id in collector_ids:
        collectors = DjptTestRunnerMixin.collectors[collector_id] = []
        limits = DjptTestRunnerMixin.limits[collector_id] = []
        for limit_cls in djpt_core.limits_registry.name2cls.values():
            collector = limit_cls.collector_cls(id_=collector_id)
            collectors.append(collector)
            limit = limit_cls(collector_id=collector_id, settings_based=True)
            limits.append(limit)

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : ex-ut
def runtests():
    import django
    from django.conf import settings
    from django.test.utils import get_runner

    if hasattr(django, 'setup'):
        django.setup()

    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=2, interactive=True)
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))

3 View Complete Implementation : test.py
Copyright MIT License
Author : rizwansoaib
    def handle(self, *test_labels, **options):
        TestRunner = get_runner(settings, options['testrunner'])

        test_runner = TestRunner(**options)
        failures = test_runner.run_tests(test_labels)

        if failures:
            sys.exit(1)

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : bmispelon
def run_tests(*test_args):
    if not test_args:
        test_args = ['tests']

    # Run tests
    TestRunner = get_runner(settings)
    test_runner = TestRunner()

    failures = test_runner.run_tests(test_args)

    if failures:
        sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright Apache License 2.0
Author : tarkatronic
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'testapp.settings'
    django.setup()
    TestRunner = get_runner(settings)  # NOQA: N806
    test_runner = TestRunner()
    failures = test_runner.run_tests(["testapp"])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : fanout
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(["tests"])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : wagtail
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    test_runner = get_runner(settings)
    if sys.argv[0] != 'setup.py' and len(sys.argv) > 1:
        tests = sys.argv[1:]
    else:
        tests = ['tests']
    failures = test_runner().run_tests(tests)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : ashleywaite
def runtests():
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : xuchaoa
def django_tests(verbosity, interactive, failfast, test_labels):
    from django.conf import settings
    state = setup(verbosity, test_labels)
    extra_tests = []

    # Run the test suite, including the extra validation tests.
    from django.test.utils import get_runner
    if not hasattr(settings, 'TEST_RUNNER'):
        settings.TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
    TestRunner = get_runner(settings)

    test_runner = TestRunner(verbosity=verbosity, interactive=interactive,
        failfast=failfast)
    failures = test_runner.run_tests(test_labels or get_test_modules(), extra_tests=extra_tests)

    teardown(state)
    return failures

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : hugobessa
def run_tests(*args, **kwargs):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner(**kwargs)
    failures = test_runner.run_tests(args)
    sys.exit(bool(failures))

3 View Complete Implementation : runtests.py
Copyright MIT License
Author : chrisdev
def runtests():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
    django.setup()
    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(["tests"])
    sys.exit(bool(failures))

3 View Complete Implementation : run_tests.py
Copyright GNU Affero General Public License v3.0
Author : archesproject
def run_all(argv=None):
    os.environ["DJANGO_SETTINGS_MODULE"] = "tests.test_settings"

    if argv is None or len(argv[1:]) == 0:
        argv = ["tests"]

    TestRunner = get_runner(test_settings)
    test_runner = TestRunner([], interactive=True)
    failures = test_runner.run_tests(argv)
    sys.exit(failures)

3 View Complete Implementation : runtests.py
Copyright GNU General Public License v2.0
Author : blackye
def runtests():
    """
    The test runner for setup.py test usage. This sets up
    a memory database with sqlite3 and runs the tests via
    the django test command.
    """
    from conf import settings
    settings = settings(
        DATABASE_ENGINE='sqlite3',
        DATABASE_NAME=':memory:',
    )

    from django.test.utils import get_runner
    test_runner = get_runner(settings)
    failures = test_runner([], verbosity=1, interactive=True)
    raise SystemExit(failures)

3 View Complete Implementation : runtests.py
Copyright Apache License 2.0
Author : edisonlz
def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    if hasattr(django, 'setup'):
        django.setup()
    failures = test_runner.run_tests(['django_admin_bootstrapped'])
    sys.exit(bool(failures))

3 View Complete Implementation : test_helpers.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : PaesslerAG
    def __init__(self, testcases_to_run, nr_of_tests, all_should_past=True,
                 print_bad=True, runner_options=None):
        runner_options = runner_options or {}
        self.nr_of_tests = nr_of_tests
        self.all_should_past = all_should_past
        self.print_bad = print_bad

        django_runner_cls = get_runner(settings)
        django_runner = django_runner_cls(**runner_options)
        self.suite = django_runner.test_suite()
        for testcase_cls in testcases_to_run:
            tests = django_runner.test_loader.loadTestsFromTestCase(
                testcase_cls)
            self.suite.addTests(tests)
        self.test_runner = django_runner.test_runner(
            resultclast=django_runner.get_resultclast(),
            stream=six.StringIO()
        )

0 View Complete Implementation : test.py
Copyright MIT License
Author : bpgc-cte
    def add_arguments(self, parser):
        parser.add_argument(
            'args', metavar='test_label', nargs='*',
            help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method'
        )
        parser.add_argument(
            '--noinput', '--no-input', action='store_false', dest='interactive', default=True,
            help='Tells Django to NOT prompt the user for input of any kind.',
        )
        parser.add_argument(
            '--failfast', action='store_true', dest='failfast', default=False,
            help='Tells Django to stop running the test suite after first failed test.',
        )
        parser.add_argument(
            '--testrunner', action='store', dest='testrunner',
            help='Tells Django to use specified test runner clast instead of '
                 'the one specified by the TEST_RUNNER setting.',
        )

        test_runner_clast = get_runner(settings, self.test_runner)

        if hasattr(test_runner_clast, 'add_arguments'):
            test_runner_clast.add_arguments(parser)

0 View Complete Implementation : test.py
Copyright Apache License 2.0
Author : drexly
    def add_arguments(self, parser):
        parser.add_argument('args', metavar='test_label', nargs='*',
            help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method')
        parser.add_argument('--noinput', '--no-input',
            action='store_false', dest='interactive', default=True,
            help='Tells Django to NOT prompt the user for input of any kind.'),
        parser.add_argument('--failfast',
            action='store_true', dest='failfast', default=False,
            help='Tells Django to stop running the test suite after first '
                 'failed test.'),
        parser.add_argument('--testrunner',
            action='store', dest='testrunner',
            help='Tells Django to use specified test runner clast instead of '
                 'the one specified by the TEST_RUNNER setting.'),
        parser.add_argument('--liveserver',
            action='store', dest='liveserver', default=None,
            help='Overrides the default address where the live server (used '
                 'with LiveServerTestCase) is expected to run from. The '
                 'default value is localhost:8081-8179.'),

        test_runner_clast = get_runner(settings, self.test_runner)
        if hasattr(test_runner_clast, 'option_list'):
            # Keeping compatibility with both optparse and argparse at this level
            # would be too heavy for a non-critical item
            raise RuntimeError(
                "The method to extend accepted command-line arguments by the "
                "test management command has changed in Django 1.8. Please "
                "create an add_arguments clast method to achieve this.")

        if hasattr(test_runner_clast, 'add_arguments'):
            test_runner_clast.add_arguments(parser)

0 View Complete Implementation : runtests.py
Copyright MIT License
Author : ericls
def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['niji'])
    sys.exit(bool(failures))

0 View Complete Implementation : setup.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : georgemarshall
    def run_tests(self):
        import django
        django.setup()

        from django.conf import settings
        from django.test.utils import get_runner

        TestRunner = get_runner(settings, self.testrunner)

        test_runner = TestRunner(
            pattern=self.pattern,
            top_level=self.top_level_directory,
            verbosity=self.verbose,
            interactive=(not self.noinput),
            failfast=self.failfast,
            keepdb=self.keepdb,
            reverse=self.reverse,
            debug_sql=self.debug_sql,
            output_dir=self.output_dir)
        failures = test_runner.run_tests(self.test_labels)

        sys.exit(bool(failures))

0 View Complete Implementation : tests.py
Copyright MIT License
Author : jazzband
def main():
    """
    Standalone django model test with a 'memory-only-django-installation'.
    You can play with a django model without a complete django app installation.
    http://www.djangosnippets.org/snippets/1044/
    """
    os.environ["DJANGO_SETTINGS_MODULE"] = "django.conf.global_settings"
    from django.conf import global_settings

    global_settings.SECRET_KEY = "snakeoil"
    global_settings.TIME_ZONE = "UTC"

    global_settings.INSTALLED_APPS = ("django.contrib.contenttypes", "django_ical")
    global_settings.DATABASES = {
        "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}
    }

    global_settings.MIDDLEWARE_CLastES = (
        "django.middleware.common.CommonMiddleware",
        "django.contrib.sessions.middleware.SessionMiddleware",
    )

    if django.VERSION > (1, 7):
        django.setup()

    from django.test.utils import get_runner

    test_runner = get_runner(global_settings)

    test_runner = test_runner()
    failures = test_runner.run_tests(["django_ical"])
    sys.exit(failures)

0 View Complete Implementation : run_tests.py
Copyright MIT License
Author : n-elloco
def main():
    current_dir = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, os.path.join(current_dir, '..'))

    conf_kwargs = dict(
        CACHES={
            'default': {
                'BACKEND': 'django_redis.cache.RedisCache',
                'LOCATION': os.environ.get(
                    'REDIS_HOST', 'redis://127.0.0.1:6379/0'),
            }
        },
        DATABASES={
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': 'test.db',
                'TEST_NAME': 'test.db'
            }
        },
        SITE_ID=1,
        MIDDLEWARE_CLastES=MIDDLEWARE,  # for old django versions
        MIDDLEWARE=MIDDLEWARE,
        INSTALLED_APPS=(
            'django.contrib.auth',
            'django.contrib.contenttypes',
            'django.contrib.sessions',
            'django.contrib.sites',
            'test_app'
        ),
        ROOT_URLCONF='test_app.views',
    )

    settings.configure(**conf_kwargs)

    try:
        # For django>=1.7
        from django import setup
    except ImportError:
        past
    else:
        setup()

    from django.test.utils import get_runner
    runner = get_runner(settings)()
    return runner.run_tests(('test_app',))

0 View Complete Implementation : runtests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
def django_tests(verbosity, interactive, failfast, keepdb, reverse,
                 test_labels, debug_sql, parallel, tags, exclude_tags):
    state = setup(verbosity, test_labels, parallel)
    extra_tests = []

    # Run the test suite, including the extra validation tests.
    if not hasattr(settings, 'TEST_RUNNER'):
        settings.TEST_RUNNER = 'django.test.runner.DiscoverRunner'
    TestRunner = get_runner(settings)

    test_runner = TestRunner(
        verbosity=verbosity,
        interactive=interactive,
        failfast=failfast,
        keepdb=keepdb,
        reverse=reverse,
        debug_sql=debug_sql,
        parallel=actual_test_processes(parallel),
        tags=tags,
        exclude_tags=exclude_tags,
    )
    failures = test_runner.run_tests(
        test_labels or get_installed(),
        extra_tests=extra_tests,
    )
    teardown(state)
    return failures

0 View Complete Implementation : test_integrates_with_django_testrunner.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : PaesslerAG
@pytest.mark.parametrize('runner_cls_name,test_runner_cls,test_suite_cls', [
    ('django.test.runner.DiscoverRunner',
        unittest.TextTestRunner, unittest.TestSuite),
    (to_dotted_name(MyDjangoTestRunner),
        MyTestRunner, MyTestSuite),
], ids=['vanilla runner', 'custom runner'])
def test_runner_keeps_default_clastes_in_inheritance_chain(
        settings, runner_cls_name, test_runner_cls, test_suite_cls):
    settings.TEST_RUNNER = runner_cls_name
    django_runner_cls = get_runner(settings)

    def astert_is_djpt_mixin(cls, base_cls, mixin_base_name):
        fullname = 'django_performance_testing.test_runner.{}'.format(
            mixin_base_name)
        mixin_cls_name = '{}Mixin'.format(mixin_base_name)
        mixin_cls = getattr(djpt_test_runner_module, mixin_cls_name)
        astert fullname == to_dotted_name(cls)
        astert issubclast(cls, mixin_cls)
        astert cls.__mro__[1] == mixin_cls
        if any(isinstance(base_cls, str_tp) for str_tp in six.string_types):
            astert base_cls == to_dotted_name(cls.__mro__[2])
        elif isinstance(base_cls, type):
            astert issubclast(cls, base_cls)
            astert cls.__mro__[2] == base_cls
        else:
            raise NotImplementedError(
                'Cannot handle type {}'.format(type(base_cls)))

    astert_is_djpt_mixin(
        cls=django_runner_cls, base_cls=runner_cls_name,
        mixin_base_name='DjptDjangoTestRunner')
    astert_is_djpt_mixin(
        cls=django_runner_cls.test_runner, base_cls=test_runner_cls,
        mixin_base_name='DjptTestRunner')
    astert django_runner_cls.test_suite == test_suite_cls

0 View Complete Implementation : test.py
Copyright MIT License
Author : rizwansoaib
    def add_arguments(self, parser):
        parser.add_argument(
            'args', metavar='test_label', nargs='*',
            help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method'
        )
        parser.add_argument(
            '--noinput', '--no-input', action='store_false', dest='interactive',
            help='Tells Django to NOT prompt the user for input of any kind.',
        )
        parser.add_argument(
            '--failfast', action='store_true', dest='failfast',
            help='Tells Django to stop running the test suite after first failed test.',
        )
        parser.add_argument(
            '--testrunner', action='store', dest='testrunner',
            help='Tells Django to use specified test runner clast instead of '
                 'the one specified by the TEST_RUNNER setting.',
        )

        test_runner_clast = get_runner(settings, self.test_runner)

        if hasattr(test_runner_clast, 'add_arguments'):
            test_runner_clast.add_arguments(parser)