diff options
| author | David Smith <smithdc@gmail.com> | 2020-07-24 07:25:47 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-09-30 09:51:31 +0200 |
| commit | 12ba61ed1755ba4a67202e95f78403240efa931b (patch) | |
| tree | 567894596142ab617a0630ea6f061a4580b72f03 /tests | |
| parent | 356efa90b5984eee25359959a20f672273199720 (diff) | |
[3.1.x] Bumped minimum isort version to 5.1.0.
Fixed inner imports per isort 5.
isort 5.0.0 to 5.1.0 was unstable.
Backport of e74b3d724e5ddfef96d1d66bd1c58e7aae26fc85 from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/annotations/tests.py | 1 | ||||
| -rw-r--r-- | tests/backends/postgresql/test_creation.py | 1 | ||||
| -rw-r--r-- | tests/backends/postgresql/tests.py | 2 | ||||
| -rw-r--r-- | tests/gis_tests/geo3d/tests.py | 2 | ||||
| -rw-r--r-- | tests/gis_tests/rasterapp/test_rasterfield.py | 4 | ||||
| -rw-r--r-- | tests/gis_tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/gis_tests/utils.py | 12 | ||||
| -rw-r--r-- | tests/model_fields/test_imagefield.py | 5 | ||||
| -rw-r--r-- | tests/model_forms/tests.py | 2 | ||||
| -rw-r--r-- | tests/postgres_tests/test_apps.py | 1 | ||||
| -rw-r--r-- | tests/postgres_tests/test_array.py | 7 | ||||
| -rw-r--r-- | tests/postgres_tests/test_bulk_update.py | 2 | ||||
| -rw-r--r-- | tests/postgres_tests/test_constraints.py | 8 | ||||
| -rw-r--r-- | tests/postgres_tests/test_json_deprecation.py | 6 | ||||
| -rw-r--r-- | tests/postgres_tests/test_operations.py | 2 | ||||
| -rw-r--r-- | tests/postgres_tests/test_ranges.py | 1 | ||||
| -rw-r--r-- | tests/postgres_tests/test_trigram.py | 4 |
17 files changed, 43 insertions, 21 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index 484061f567..836c0ebb1d 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -26,6 +26,7 @@ def cxOracle_py3_bug(func): we mark them as expected failures until someone fixes them in #23843. """ from unittest import expectedFailure + from django.db import connection return expectedFailure(func) if connection.vendor == 'oracle' else func diff --git a/tests/backends/postgresql/test_creation.py b/tests/backends/postgresql/test_creation.py index f6a067248d..20f5f7ede9 100644 --- a/tests/backends/postgresql/test_creation.py +++ b/tests/backends/postgresql/test_creation.py @@ -13,6 +13,7 @@ except ImportError: pass else: from psycopg2 import errorcodes + from django.db.backends.postgresql.creation import DatabaseCreation diff --git a/tests/backends/postgresql/tests.py b/tests/backends/postgresql/tests.py index 1dcb14b964..8d0a801ea2 100644 --- a/tests/backends/postgresql/tests.py +++ b/tests/backends/postgresql/tests.py @@ -129,10 +129,10 @@ class Tests(TestCase): ISOLATION_LEVEL_READ_COMMITTED as read_committed, ISOLATION_LEVEL_SERIALIZABLE as serializable, ) + # Since this is a django.test.TestCase, a transaction is in progress # and the isolation level isn't reported as 0. This test assumes that # PostgreSQL is configured with the default isolation level. - # Check the level on the psycopg2 connection, not the Django wrapper. default_level = read_committed if psycopg2.__version__ < '2.7' else None self.assertEqual(connection.connection.isolation_level, default_level) diff --git a/tests/gis_tests/geo3d/tests.py b/tests/gis_tests/geo3d/tests.py index d8a788ef4e..ad34caf7e0 100644 --- a/tests/gis_tests/geo3d/tests.py +++ b/tests/gis_tests/geo3d/tests.py @@ -142,7 +142,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase): Testing LayerMapping on 3D models. """ # Import here as GDAL is required for those imports - from django.contrib.gis.utils import LayerMapping, LayerMapError + from django.contrib.gis.utils import LayerMapError, LayerMapping point_mapping = {'point': 'POINT'} mpoint_mapping = {'mpoint': 'MULTIPOINT'} diff --git a/tests/gis_tests/rasterapp/test_rasterfield.py b/tests/gis_tests/rasterapp/test_rasterfield.py index b9467f1452..306bb85b19 100644 --- a/tests/gis_tests/rasterapp/test_rasterfield.py +++ b/tests/gis_tests/rasterapp/test_rasterfield.py @@ -143,7 +143,9 @@ class RasterFieldTest(TransactionTestCase): unprojected coordinate systems. This test just checks that the lookup can be called, but doesn't check if the result makes logical sense. """ - from django.contrib.gis.db.backends.postgis.operations import PostGISOperations + from django.contrib.gis.db.backends.postgis.operations import ( + PostGISOperations, + ) # Create test raster and geom. rast = GDALRaster(json.loads(JSON_RASTER)) diff --git a/tests/gis_tests/tests.py b/tests/gis_tests/tests.py index e8ecca9ceb..2bb95ec3d4 100644 --- a/tests/gis_tests/tests.py +++ b/tests/gis_tests/tests.py @@ -4,7 +4,9 @@ from django.core.exceptions import ImproperlyConfigured from django.db import ProgrammingError try: - from django.contrib.gis.db.backends.postgis.operations import PostGISOperations + from django.contrib.gis.db.backends.postgis.operations import ( + PostGISOperations, + ) HAS_POSTGRES = True except ImportError: HAS_POSTGRES = False diff --git a/tests/gis_tests/utils.py b/tests/gis_tests/utils.py index d9f81e3c5d..857a608f48 100644 --- a/tests/gis_tests/utils.py +++ b/tests/gis_tests/utils.py @@ -53,11 +53,17 @@ spatialite = _default_db == 'spatialite' gisfield_may_be_null = not mysql if oracle and 'gis' in settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE']: - from django.contrib.gis.db.backends.oracle.models import OracleSpatialRefSys as SpatialRefSys + from django.contrib.gis.db.backends.oracle.models import ( + OracleSpatialRefSys as SpatialRefSys, + ) elif postgis: - from django.contrib.gis.db.backends.postgis.models import PostGISSpatialRefSys as SpatialRefSys + from django.contrib.gis.db.backends.postgis.models import ( + PostGISSpatialRefSys as SpatialRefSys, + ) elif spatialite: - from django.contrib.gis.db.backends.spatialite.models import SpatialiteSpatialRefSys as SpatialRefSys + from django.contrib.gis.db.backends.spatialite.models import ( + SpatialiteSpatialRefSys as SpatialRefSys, + ) else: SpatialRefSys = None diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py index 99831cb0a3..cbb58a0bbd 100644 --- a/tests/model_fields/test_imagefield.py +++ b/tests/model_fields/test_imagefield.py @@ -15,10 +15,9 @@ except ImproperlyConfigured: if Image: from .models import ( - Person, PersonWithHeight, PersonWithHeightAndWidth, - PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile, + Person, PersonDimensionsFirst, PersonTwoImages, PersonWithHeight, + PersonWithHeightAndWidth, TestImageFieldFile, temp_storage_dir, ) - from .models import temp_storage_dir else: # Pillow not available, create dummy classes (tests will be skipped anyway) class Person: diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 00e68d1dae..3e8aab963c 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -30,7 +30,7 @@ from .models import ( ) if test_images: - from .models import ImageFile, OptionalImageFile, NoExtensionImageFile + from .models import ImageFile, NoExtensionImageFile, OptionalImageFile class ImageFileForm(forms.ModelForm): class Meta: diff --git a/tests/postgres_tests/test_apps.py b/tests/postgres_tests/test_apps.py index 7b56c8f716..bfb7568d50 100644 --- a/tests/postgres_tests/test_apps.py +++ b/tests/postgres_tests/test_apps.py @@ -8,6 +8,7 @@ try: from psycopg2.extras import ( DateRange, DateTimeRange, DateTimeTZRange, NumericRange, ) + from django.contrib.postgres.fields import ( DateRangeField, DateTimeRangeField, IntegerRangeField, ) diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index ee66fbcd60..a3095ae9ff 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -25,14 +25,17 @@ from .models import ( ) try: + from psycopg2.extras import NumericRange + from django.contrib.postgres.aggregates import ArrayAgg from django.contrib.postgres.fields import ArrayField - from django.contrib.postgres.fields.array import IndexTransform, SliceTransform + from django.contrib.postgres.fields.array import ( + IndexTransform, SliceTransform, + ) from django.contrib.postgres.forms import ( SimpleArrayField, SplitArrayField, SplitArrayWidget, ) from django.db.backends.postgresql.base import PSYCOPG2_VERSION - from psycopg2.extras import NumericRange except ImportError: pass diff --git a/tests/postgres_tests/test_bulk_update.py b/tests/postgres_tests/test_bulk_update.py index 7fa2a6a7db..da5aee0f70 100644 --- a/tests/postgres_tests/test_bulk_update.py +++ b/tests/postgres_tests/test_bulk_update.py @@ -7,7 +7,7 @@ from .models import ( ) try: - from psycopg2.extras import NumericRange, DateRange + from psycopg2.extras import DateRange, NumericRange except ImportError: pass # psycopg2 isn't installed. diff --git a/tests/postgres_tests/test_constraints.py b/tests/postgres_tests/test_constraints.py index 55b73778cc..4c2e04705d 100644 --- a/tests/postgres_tests/test_constraints.py +++ b/tests/postgres_tests/test_constraints.py @@ -9,10 +9,12 @@ from . import PostgreSQLTestCase from .models import HotelReservation, RangesModel, Room try: - from django.contrib.postgres.constraints import ExclusionConstraint - from django.contrib.postgres.fields import DateTimeRangeField, RangeBoundary, RangeOperators - from psycopg2.extras import DateRange, NumericRange + + from django.contrib.postgres.constraints import ExclusionConstraint + from django.contrib.postgres.fields import ( + DateTimeRangeField, RangeBoundary, RangeOperators, + ) except ImportError: pass diff --git a/tests/postgres_tests/test_json_deprecation.py b/tests/postgres_tests/test_json_deprecation.py index 80deb0cb15..69dcce3781 100644 --- a/tests/postgres_tests/test_json_deprecation.py +++ b/tests/postgres_tests/test_json_deprecation.py @@ -1,7 +1,9 @@ try: - from django.contrib.postgres.fields import JSONField - from django.contrib.postgres.fields.jsonb import KeyTransform, KeyTextTransform from django.contrib.postgres import forms + from django.contrib.postgres.fields import JSONField + from django.contrib.postgres.fields.jsonb import ( + KeyTextTransform, KeyTransform, + ) except ImportError: pass diff --git a/tests/postgres_tests/test_operations.py b/tests/postgres_tests/test_operations.py index 7bcf6b2300..958c8118a1 100644 --- a/tests/postgres_tests/test_operations.py +++ b/tests/postgres_tests/test_operations.py @@ -11,10 +11,10 @@ from django.test.utils import CaptureQueriesContext from . import PostgreSQLTestCase try: + from django.contrib.postgres.indexes import BrinIndex, BTreeIndex from django.contrib.postgres.operations import ( AddIndexConcurrently, CreateExtension, RemoveIndexConcurrently, ) - from django.contrib.postgres.indexes import BrinIndex, BTreeIndex except ImportError: pass diff --git a/tests/postgres_tests/test_ranges.py b/tests/postgres_tests/test_ranges.py index 7257d66505..e3f095d6a4 100644 --- a/tests/postgres_tests/test_ranges.py +++ b/tests/postgres_tests/test_ranges.py @@ -18,6 +18,7 @@ from .models import ( try: from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange + from django.contrib.postgres import fields as pg_fields, forms as pg_forms from django.contrib.postgres.validators import ( RangeMaxValueValidator, RangeMinValueValidator, diff --git a/tests/postgres_tests/test_trigram.py b/tests/postgres_tests/test_trigram.py index 19ac4cee31..a5d7d868be 100644 --- a/tests/postgres_tests/test_trigram.py +++ b/tests/postgres_tests/test_trigram.py @@ -4,7 +4,9 @@ from . import PostgreSQLTestCase from .models import CharFieldModel, TextFieldModel try: - from django.contrib.postgres.search import TrigramDistance, TrigramSimilarity + from django.contrib.postgres.search import ( + TrigramDistance, TrigramSimilarity, + ) except ImportError: pass |
