diff options
| author | Shai Berger <shai@platonix.com> | 2015-06-05 10:32:29 +0300 |
|---|---|---|
| committer | Shai Berger <shai@platonix.com> | 2015-06-05 12:57:20 +0300 |
| commit | 071801ccff970682a799ce754431a3c3ce3d6902 (patch) | |
| tree | 838e774455719f7110b15e74e3d7cb6722e1d8f0 /tests/backends | |
| parent | 1f28521e0ac81dcc660a5b9891f45a20306e093a (diff) | |
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
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/tests.py | 5 |
1 files changed, 1 insertions, 4 deletions
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")) |
