Skipped unnecessary system checks in user_commands test.

This commit is contained in:
Adam Chainz 2016-08-14 11:53:32 +02:00 committed by Tim Graham
parent 241e1e3cd7
commit 7dc8d9238a
1 changed files with 6 additions and 2 deletions

View File

@ -55,8 +55,12 @@ class CommandTests(SimpleTestCase):
"""
with self.assertRaises(CommandError):
management.call_command('dance', example="raise")
with captured_stderr() as stderr, self.assertRaises(SystemExit):
management.ManagementUtility(['manage.py', 'dance', '--example=raise']).execute()
dance.Command.requires_system_checks = False
try:
with captured_stderr() as stderr, self.assertRaises(SystemExit):
management.ManagementUtility(['manage.py', 'dance', '--example=raise']).execute()
finally:
dance.Command.requires_system_checks = True
self.assertIn("CommandError", stderr.getvalue())
def test_deactivate_locale_set(self):