Skip to content

Commit f2e80f6

Browse files
hramezanibluetech
authored andcommitted
Fix isort errors.
1 parent d74114e commit f2e80f6

16 files changed

+41
-48
lines changed

pytest_django/asserts.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
"""
22
Dynamically load all Django assertion cases and expose them for importing.
33
"""
4-
from typing import Any, Callable, Optional, Sequence, Set, Union
54
from functools import wraps
5+
from typing import Any, Callable, Optional, Sequence, Set, Union
66

77
from django.test import (
8-
TestCase, SimpleTestCase,
9-
LiveServerTestCase, TransactionTestCase
8+
LiveServerTestCase, SimpleTestCase, TestCase, TransactionTestCase,
109
)
1110

1211
TYPE_CHECKING = False

pytest_django/fixtures.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
"""All pytest-django fixtures"""
2-
from typing import Any, Callable, Generator, Iterable, List, Optional, Tuple, Union
32
import os
43
from contextlib import contextmanager
54
from functools import partial
5+
from typing import (
6+
Any, Callable, Generator, Iterable, List, Optional, Tuple, Union,
7+
)
68

79
import pytest
810

911
from . import live_server_helper
1012
from .django_compat import is_django_unittest
11-
from .lazy_django import skip_if_no_django, get_django_version
13+
from .lazy_django import get_django_version, skip_if_no_django
1214

1315
TYPE_CHECKING = False
1416
if TYPE_CHECKING:
@@ -155,8 +157,8 @@ def _django_db_fixture_helper(
155157
django_db_blocker.unblock()
156158
request.addfinalizer(django_db_blocker.restore)
157159

158-
import django.test
159160
import django.db
161+
import django.test
160162

161163
if transactional:
162164
test_case_class = django.test.TransactionTestCase

pytest_django/lazy_django.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Helpers to load Django lazily when Django settings can't be configured.
33
"""
4-
from typing import Any, Tuple
54
import os
65
import sys
6+
from typing import Any, Tuple
77

88
import pytest
99

pytest_django/live_server_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, Any
1+
from typing import Any, Dict
22

33

44
class LiveServer:

pytest_django/plugin.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,42 @@
44
test database and provides some useful text fixtures.
55
"""
66

7-
from typing import Generator, List, Optional, Tuple, Union
87
import contextlib
98
import inspect
10-
from functools import reduce
119
import os
1210
import pathlib
1311
import sys
12+
from functools import reduce
13+
from typing import Generator, List, Optional, Tuple, Union
1414

1515
import pytest
1616

1717
from .django_compat import is_django_unittest # noqa
18-
from .fixtures import django_assert_num_queries # noqa
19-
from .fixtures import django_assert_max_num_queries # noqa
20-
from .fixtures import django_db_setup # noqa
21-
from .fixtures import django_db_use_migrations # noqa
22-
from .fixtures import django_db_keepdb # noqa
23-
from .fixtures import django_db_createdb # noqa
24-
from .fixtures import django_db_modify_db_settings # noqa
25-
from .fixtures import django_db_modify_db_settings_parallel_suffix # noqa
26-
from .fixtures import django_db_modify_db_settings_tox_suffix # noqa
27-
from .fixtures import django_db_modify_db_settings_xdist_suffix # noqa
28-
from .fixtures import django_capture_on_commit_callbacks # noqa
2918
from .fixtures import _live_server_helper # noqa
3019
from .fixtures import admin_client # noqa
3120
from .fixtures import admin_user # noqa
3221
from .fixtures import async_client # noqa
22+
from .fixtures import async_rf # noqa
3323
from .fixtures import client # noqa
3424
from .fixtures import db # noqa
25+
from .fixtures import django_assert_max_num_queries # noqa
26+
from .fixtures import django_assert_num_queries # noqa
27+
from .fixtures import django_capture_on_commit_callbacks # noqa
28+
from .fixtures import django_db_createdb # noqa
29+
from .fixtures import django_db_keepdb # noqa
30+
from .fixtures import django_db_modify_db_settings # noqa
31+
from .fixtures import django_db_modify_db_settings_parallel_suffix # noqa
32+
from .fixtures import django_db_modify_db_settings_tox_suffix # noqa
33+
from .fixtures import django_db_modify_db_settings_xdist_suffix # noqa
34+
from .fixtures import django_db_reset_sequences # noqa
35+
from .fixtures import django_db_setup # noqa
36+
from .fixtures import django_db_use_migrations # noqa
3537
from .fixtures import django_user_model # noqa
3638
from .fixtures import django_username_field # noqa
3739
from .fixtures import live_server # noqa
38-
from .fixtures import django_db_reset_sequences # noqa
39-
from .fixtures import async_rf # noqa
4040
from .fixtures import rf # noqa
4141
from .fixtures import settings # noqa
4242
from .fixtures import transactional_db # noqa
43-
4443
from .lazy_django import django_settings_is_configured, skip_if_no_django
4544

4645
TYPE_CHECKING = False
@@ -416,7 +415,9 @@ def django_test_environment(request) -> None:
416415
"""
417416
if django_settings_is_configured():
418417
_setup_django()
419-
from django.test.utils import setup_test_environment, teardown_test_environment
418+
from django.test.utils import (
419+
setup_test_environment, teardown_test_environment,
420+
)
420421

421422
debug_ini = request.config.getini("django_debug_mode")
422423
if debug_ini == "keep":

pytest_django_test/db_helpers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import os
2-
import subprocess
32
import sqlite3
3+
import subprocess
44

55
import pytest
6-
76
from django.conf import settings
87
from django.utils.encoding import force_str
98

10-
119
# Construct names for the "inner" database used in runpytest tests
1210
_settings = settings.DATABASES["default"]
1311

pytest_django_test/settings_mysql_innodb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .settings_base import * # noqa: F401 F403
44

5-
65
DATABASES = {
76
"default": {
87
"ENGINE": "django.db.backends.mysql",

pytest_django_test/settings_mysql_myisam.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .settings_base import * # noqa: F401 F403
44

5-
65
DATABASES = {
76
"default": {
87
"ENGINE": "django.db.backends.mysql",

pytest_django_test/settings_sqlite.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .settings_base import * # noqa: F401 F403
22

3-
43
DATABASES = {
54
"default": {
65
"ENGINE": "django.db.backends.sqlite3",

pytest_django_test/urls_overridden.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from django.urls import path
21
from django.http import HttpResponse
2+
from django.urls import path
33

44
urlpatterns = [
55
path("overridden_url/", lambda r: HttpResponse("Overridden urlconf works!"))

tests/conftest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
from typing import Optional
21
import copy
2+
import pathlib
33
import shutil
44
from textwrap import dedent
5-
import pathlib
5+
from typing import Optional
66

77
import pytest
88
from django.conf import settings
99

10-
1110
pytest_plugins = "pytester"
1211

1312
REPOSITORY_ROOT = pathlib.Path(__file__).parent
@@ -40,7 +39,7 @@ def testdir(testdir, monkeypatch):
4039
@pytest.fixture(scope="function")
4140
def django_testdir(request, testdir, monkeypatch):
4241
from pytest_django_test.db_helpers import (
43-
DB_NAME, TEST_DB_NAME, SECOND_DB_NAME, SECOND_TEST_DB_NAME,
42+
DB_NAME, SECOND_DB_NAME, SECOND_TEST_DB_NAME, TEST_DB_NAME,
4443
)
4544

4645
marker = request.node.get_closest_marker("django_project")

tests/test_asserts.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
"""
22
Tests the dynamic loading of all Django assertion cases.
33
"""
4-
from typing import List
54
import inspect
5+
from typing import List
66

77
import pytest
8-
import pytest_django
98

9+
import pytest_django
1010
from pytest_django.asserts import __all__ as asserts_all
1111

1212

1313
def _get_actual_assertions_names() -> List[str]:
1414
"""
1515
Returns list with names of all assertion helpers in Django.
1616
"""
17-
from django.test import TestCase as DjangoTestCase
1817
from unittest import TestCase as DefaultTestCase
1918

19+
from django.test import TestCase as DjangoTestCase
20+
2021
obj = DjangoTestCase('run')
2122

2223
def is_assert(func) -> bool:
@@ -42,6 +43,7 @@ def test_django_asserts_available() -> None:
4243
@pytest.mark.django_db
4344
def test_sanity() -> None:
4445
from django.http import HttpResponse
46+
4547
from pytest_django.asserts import assertContains, assertNumQueries
4648

4749
response = HttpResponse('My response')

tests/test_db_setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import pytest
22

33
from pytest_django_test.db_helpers import (
4-
db_exists,
5-
drop_database,
6-
mark_database,
7-
mark_exists,
4+
db_exists, drop_database, mark_database, mark_exists,
85
skip_if_sqlite_in_memory,
96
)
107

tests/test_django_settings_module.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import pytest
77

8-
98
BARE_SETTINGS = """
109
# At least one database must be configured
1110
DATABASES = {

tests/test_environment.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import os
22

33
import pytest
4-
from django.contrib.sites.models import Site
54
from django.contrib.sites import models as site_models
5+
from django.contrib.sites.models import Site
66
from django.core import mail
77
from django.db import connection
88
from django.test import TestCase
99

1010
from pytest_django_test.app.models import Item
1111

12-
1312
# It doesn't matter which order all the _again methods are run, we just need
1413
# to check the environment remains constant.
1514
# This is possible with some of the testdir magic, but this is the lazy way

tests/test_fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Not quite all fixtures are tested here, the db and transactional_db
44
fixtures are tested in test_database.
55
"""
6-
from typing import Generator
76
import socket
87
from contextlib import contextmanager
8+
from typing import Generator
99
from urllib.error import HTTPError
1010
from urllib.request import urlopen
1111

@@ -16,8 +16,8 @@
1616
from django.test.client import Client, RequestFactory
1717
from django.utils.encoding import force_str
1818

19-
from pytest_django_test.app.models import Item
2019
from pytest_django.lazy_django import get_django_version
20+
from pytest_django_test.app.models import Item
2121

2222

2323
@contextmanager

0 commit comments

Comments
 (0)