mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #25500 -- Added --fail-level option to check command.
This option specifies the level that check command exits with a non-zero status. Default is ``ERROR``.
This commit is contained in:
@@ -116,7 +116,7 @@ def simple_system_check(**kwargs):
|
||||
|
||||
def tagged_system_check(**kwargs):
|
||||
tagged_system_check.kwargs = kwargs
|
||||
return []
|
||||
return [checks.Warning('System Check')]
|
||||
tagged_system_check.tags = ['simpletag']
|
||||
|
||||
|
||||
@@ -192,6 +192,11 @@ class CheckCommandTests(SimpleTestCase):
|
||||
call_command('check', deploy=True, tags=['deploymenttag'])
|
||||
self.assertIn('Deployment Check', sys.stderr.getvalue())
|
||||
|
||||
@override_system_checks([tagged_system_check])
|
||||
def test_fail_level(self):
|
||||
with self.assertRaises(CommandError):
|
||||
call_command('check', fail_level='WARNING')
|
||||
|
||||
|
||||
def custom_error_system_check(app_configs, **kwargs):
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user