mirror of https://github.com/django/django.git
Refs #31055 -- Made DiscoverRunner skip running system checks on unused test databases.
This commit is contained in:
parent
0b83c8cc4d
commit
430e796980
|
@ -630,10 +630,10 @@ class DiscoverRunner:
|
|||
'buffer': self.buffer,
|
||||
}
|
||||
|
||||
def run_checks(self):
|
||||
def run_checks(self, databases):
|
||||
# Checks are run after database creation since some checks require
|
||||
# database access.
|
||||
call_command('check', verbosity=self.verbosity)
|
||||
call_command('check', verbosity=self.verbosity, databases=databases)
|
||||
|
||||
def run_suite(self, suite, **kwargs):
|
||||
kwargs = self.get_test_runner_kwargs()
|
||||
|
@ -695,7 +695,7 @@ class DiscoverRunner:
|
|||
old_config = self.setup_databases(aliases=databases)
|
||||
run_failed = False
|
||||
try:
|
||||
self.run_checks()
|
||||
self.run_checks(databases)
|
||||
result = self.run_suite(suite)
|
||||
except Exception:
|
||||
run_failed = True
|
||||
|
|
|
@ -332,6 +332,9 @@ Tests
|
|||
* Django test runner now supports a :option:`test --buffer` option to discard
|
||||
output for passing tests.
|
||||
|
||||
* :class:`~django.test.runner.DiscoverRunner` now skips running the system
|
||||
checks on databases not :ref:`referenced by tests<testing-multi-db>`.
|
||||
|
||||
URLs
|
||||
~~~~
|
||||
|
||||
|
|
|
@ -637,9 +637,13 @@ Methods
|
|||
Creates the test databases by calling
|
||||
:func:`~django.test.utils.setup_databases`.
|
||||
|
||||
.. method:: DiscoverRunner.run_checks()
|
||||
.. method:: DiscoverRunner.run_checks(databases)
|
||||
|
||||
Runs the :doc:`system checks </topics/checks>`.
|
||||
Runs the :doc:`system checks </topics/checks>` on the test ``databases``.
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
The ``databases`` parameter was added.
|
||||
|
||||
.. method:: DiscoverRunner.run_suite(suite, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue