MCPcopy
hub / github.com/django/django / django_tests

Function django_tests

tests/runtests.py:347–415  ·  view source on GitHub ↗
(
    verbosity,
    interactive,
    failfast,
    keepdb,
    reverse,
    test_labels,
    debug_sql,
    parallel,
    tags,
    exclude_tags,
    test_name_patterns,
    start_at,
    start_after,
    pdb,
    buffer,
    timing,
    shuffle,
    durations=None,
)

Source from the content-addressed store, hash-verified

345
346
347def django_tests(
348 verbosity,
349 interactive,
350 failfast,
351 keepdb,
352 reverse,
353 test_labels,
354 debug_sql,
355 parallel,
356 tags,
357 exclude_tags,
358 test_name_patterns,
359 start_at,
360 start_after,
361 pdb,
362 buffer,
363 timing,
364 shuffle,
365 durations=None,
366):
367 if parallel in {0, "auto"}:
368 max_parallel = get_max_test_processes()
369 else:
370 max_parallel = parallel
371
372 if verbosity >= 1:
373 msg = "Testing against Django installed in '%s'" % os.path.dirname(
374 django.__file__
375 )
376 if max_parallel > 1:
377 msg += " with up to %d processes" % max_parallel
378 print(msg)
379
380 process_setup_args = (verbosity, start_at, start_after, test_labels)
381 test_labels, state = setup_run_tests(*process_setup_args)
382 # Run the test suite, including the extra validation tests.
383 if not hasattr(settings, "TEST_RUNNER"):
384 settings.TEST_RUNNER = "django.test.runner.DiscoverRunner"
385
386 if parallel in {0, "auto"}:
387 # This doesn't work before django.setup() on some databases.
388 if all(conn.features.can_clone_databases for conn in connections.all()):
389 parallel = max_parallel
390 else:
391 parallel = 1
392
393 TestRunner = get_runner(settings)
394 TestRunner.parallel_test_suite.process_setup = setup_run_tests
395 TestRunner.parallel_test_suite.process_setup_args = process_setup_args
396 test_runner = TestRunner(
397 verbosity=verbosity,
398 interactive=interactive,
399 failfast=failfast,
400 keepdb=keepdb,
401 reverse=reverse,
402 debug_sql=debug_sql,
403 parallel=parallel,
404 tags=tags,

Callers 1

runtests.pyFile · 0.85

Calls 7

get_max_test_processesFunction · 0.90
get_runnerFunction · 0.90
setup_run_testsFunction · 0.85
TestRunnerClass · 0.85
teardown_run_testsFunction · 0.85
allMethod · 0.45
run_testsMethod · 0.45

Tested by

no test coverage detected