mirror of
https://github.com/django/django.git
synced 2025-08-30 07:17:49 +00:00
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
This commit is contained in:
parent
c1b6f554e4
commit
c9ae09addf
30 changed files with 205 additions and 447 deletions
|
@ -224,10 +224,7 @@ class SilencingCheckTests(SimpleTestCase):
|
|||
def test_silenced_error(self):
|
||||
out = StringIO()
|
||||
err = StringIO()
|
||||
try:
|
||||
call_command('check', stdout=out, stderr=err)
|
||||
except CommandError:
|
||||
self.fail("The mycheck.E001 check should be silenced.")
|
||||
call_command('check', stdout=out, stderr=err)
|
||||
self.assertEqual(out.getvalue(), 'System check identified no issues (1 silenced).\n')
|
||||
self.assertEqual(err.getvalue(), '')
|
||||
|
||||
|
@ -236,11 +233,7 @@ class SilencingCheckTests(SimpleTestCase):
|
|||
def test_silenced_warning(self):
|
||||
out = StringIO()
|
||||
err = StringIO()
|
||||
try:
|
||||
call_command('check', stdout=out, stderr=err)
|
||||
except CommandError:
|
||||
self.fail("The mycheck.E001 check should be silenced.")
|
||||
|
||||
call_command('check', stdout=out, stderr=err)
|
||||
self.assertEqual(out.getvalue(), 'System check identified no issues (1 silenced).\n')
|
||||
self.assertEqual(err.getvalue(), '')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue