summaryrefslogtreecommitdiff
path: root/tests/check_framework
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerTim Graham <timograham@gmail.com>2016-07-01 09:58:56 -0400
commit567cfc1601a5f475eea12bc5de53b849fa5dadea (patch)
treec471ba1af748008e4fbe9faee8cf51d4dffcd263 /tests/check_framework
parent9c48e17480432b8723fcdcc262d8d62866e93a4f (diff)
[1.10.x] Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions. Backport of c9ae09addffb839403312131d4251e9d8b454508 from master
Diffstat (limited to 'tests/check_framework')
-rw-r--r--tests/check_framework/tests.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py
index 6e4115140a..e57e824ecb 100644
--- a/tests/check_framework/tests.py
+++ b/tests/check_framework/tests.py
@@ -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(), '')