summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2016-03-18 14:24:13 +0000
committerTim Graham <timograham@gmail.com>2016-12-29 12:33:24 -0500
commit5eff8a77838540b27b6bef024dfccfd76008fd4c (patch)
treea02cf84f771decc66da14657b49c65b84081714d /django
parent391c450fbae8c3301954563288147578a1ae4a6d (diff)
Fixed #25415 -- Made DiscoverRunner run system checks.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/test.py1
-rw-r--r--django/test/runner.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index e94fd989f1..b1186f20fc 100644
--- a/django/core/management/commands/test.py
+++ b/django/core/management/commands/test.py
@@ -8,6 +8,7 @@ from django.test.utils import get_runner
class Command(BaseCommand):
help = 'Discover and run tests in the specified modules or the current directory.'
+ # DiscoverRunner runs the checks after databases are set up.
requires_system_checks = False
def __init__(self):
diff --git a/django/test/runner.py b/django/test/runner.py
index 8b4c608c08..487ec7c682 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -9,6 +9,7 @@ import unittest
import warnings
from importlib import import_module
+from django.core.management import call_command
from django.db import connections
from django.test import SimpleTestCase, TestCase
from django.test.utils import (
@@ -555,6 +556,11 @@ class DiscoverRunner(object):
verbosity=self.verbosity,
)
+ def run_checks(self):
+ # Checks are run after database creation since some checks require
+ # database access.
+ call_command('check', verbosity=self.verbosity)
+
def run_suite(self, suite, **kwargs):
kwargs = self.get_test_runner_kwargs()
runner = self.test_runner(**kwargs)
@@ -593,6 +599,7 @@ class DiscoverRunner(object):
self.setup_test_environment()
suite = self.build_suite(test_labels, extra_tests)
old_config = self.setup_databases()
+ self.run_checks()
result = self.run_suite(suite)
self.teardown_databases(old_config)
self.teardown_test_environment()