mirror of
https://github.com/django/django.git
synced 2025-08-29 15:04:38 +00:00
Refs #31055 -- Added --database option to the check management command.
This avoids enabling the ``database`` checks unless they are explicitly requested and allows to disable on a per-alias basis which is required when only creating a subset of the test databases. This also removes unnecessary BaseCommand._run_checks() hook.
This commit is contained in:
parent
9cc743d0c8
commit
0b83c8cc4d
10 changed files with 66 additions and 56 deletions
|
@ -160,22 +160,22 @@ class CheckCommandTests(SimpleTestCase):
|
|||
@override_system_checks([simple_system_check, tagged_system_check])
|
||||
def test_simple_call(self):
|
||||
call_command('check')
|
||||
self.assertEqual(simple_system_check.kwargs, {'app_configs': None})
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': None})
|
||||
self.assertEqual(simple_system_check.kwargs, {'app_configs': None, 'databases': None})
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': None, 'databases': None})
|
||||
|
||||
@override_system_checks([simple_system_check, tagged_system_check])
|
||||
def test_given_app(self):
|
||||
call_command('check', 'auth', 'admin')
|
||||
auth_config = apps.get_app_config('auth')
|
||||
admin_config = apps.get_app_config('admin')
|
||||
self.assertEqual(simple_system_check.kwargs, {'app_configs': [auth_config, admin_config]})
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': [auth_config, admin_config]})
|
||||
self.assertEqual(simple_system_check.kwargs, {'app_configs': [auth_config, admin_config], 'databases': None})
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': [auth_config, admin_config], 'databases': None})
|
||||
|
||||
@override_system_checks([simple_system_check, tagged_system_check])
|
||||
def test_given_tag(self):
|
||||
call_command('check', tags=['simpletag'])
|
||||
self.assertIsNone(simple_system_check.kwargs)
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': None})
|
||||
self.assertEqual(tagged_system_check.kwargs, {'app_configs': None, 'databases': None})
|
||||
|
||||
@override_system_checks([simple_system_check, tagged_system_check])
|
||||
def test_invalid_tag(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue