From 071801ccff970682a799ce754431a3c3ce3d6902 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Fri, 5 Jun 2015 10:32:29 +0300 Subject: Cleanup: Removed the try-except-fail antipattern from tests Found cases where testing code was doing try: whatever except (some excption type): self.fail("exception shouldn't be thrown") replaced it with just whatever as this makes the unexpected errors easier to debug, and the tests would fail just as much and aren't rendered less readable. Thanks Markus Holtermann for review --- tests/backends/tests.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tests/backends') diff --git a/tests/backends/tests.py b/tests/backends/tests.py index f5ec488c86..fc62c6587c 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -370,10 +370,7 @@ class LastExecutedQueryTest(TestCase): query has been run. """ cursor = connection.cursor() - try: - connection.ops.last_executed_query(cursor, '', ()) - except Exception: - self.fail("'last_executed_query' should not raise an exception.") + connection.ops.last_executed_query(cursor, '', ()) def test_debug_sql(self): list(models.Reporter.objects.filter(first_name="test")) -- cgit v1.3