summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-16 09:07:51 -0400
committerTim Graham <timograham@gmail.com>2016-06-16 09:12:50 -0400
commitea34426ae789d31b036f58c8fd59ce299649e91e (patch)
tree37478fcf8720331973b11bc7c0d2f21094d82a14 /tests
parent96f97691ad5e1483263cea3bb4e4021b4c8dcc41 (diff)
downloaddjango-ea34426ae789d31b036f58c8fd59ce299649e91e.tar.gz
Fixed flake8 2.6 warnings.
Diffstat (limited to 'tests')
-rw-r--r--tests/postgres_tests/migrations/0002_create_test_models.py6
-rw-r--r--tests/servers/tests.py14
2 files changed, 9 insertions, 11 deletions
diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py
index 3e6cbac246..69c5b17f77 100644
--- a/tests/postgres_tests/migrations/0002_create_test_models.py
+++ b/tests/postgres_tests/migrations/0002_create_test_models.py
@@ -3,7 +3,11 @@ from __future__ import unicode_literals
from django.db import migrations, models
-from ..fields import * # NOQA
+from ..fields import (
+ ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
+ FloatRangeField, HStoreField, IntegerRangeField, JSONField,
+ SearchVectorField,
+)
from ..models import TagField
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index 39faba2023..57573622b0 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -104,12 +104,9 @@ class LiveServerViews(LiveServerBase):
Ensure that the LiveServerTestCase serves 404s.
Refs #2879.
"""
- try:
+ with self.assertRaises(HTTPError) as err:
self.urlopen('/')
- except HTTPError as err:
- self.assertEqual(err.code, 404, 'Expected 404 response')
- else:
- self.fail('Expected 404 response')
+ self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_view(self):
"""
@@ -133,12 +130,9 @@ class LiveServerViews(LiveServerBase):
tries to access a static file that isn't explicitly put under
STATIC_ROOT.
"""
- try:
+ with self.assertRaises(HTTPError) as err:
self.urlopen('/static/another_app/another_app_static_file.txt')
- except HTTPError as err:
- self.assertEqual(err.code, 404, 'Expected 404 response')
- else:
- self.fail('Expected 404 response (got %d)' % err.code)
+ self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_media_files(self):
"""