Skip to content

Commit

Permalink
Update pytest style to match update Ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Aug 15, 2024
1 parent 5e1377d commit a5e6a15
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def _media_storage(settings, tmpdir) -> None:
settings.MEDIA_ROOT = tmpdir.strpath


@pytest.fixture()
@pytest.fixture
def user(db) -> User:
return UserFactory()
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_view_user(self, admin_client):
response = admin_client.get(url)
assert response.status_code == HTTPStatus.OK

@pytest.fixture()
@pytest.fixture
def _force_allauth(self, settings):
settings.DJANGO_ADMIN_FORCE_ALLAUTH = True
# Reload the admin module to apply the setting change
Expand All @@ -65,7 +65,7 @@ def _force_allauth(self, settings):
with contextlib.suppress(admin.sites.AlreadyRegistered): # type: ignore[attr-defined]
reload(users_admin)

@pytest.mark.django_db()
@pytest.mark.django_db
@pytest.mark.usefixtures("_force_allauth")
def test_allauth_login(self, rf, settings):
request = rf.get("/fake-url")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class TestUserViewSet:
@pytest.fixture()
@pytest.fixture
def api_rf(self) -> APIRequestFactory:
return APIRequestFactory()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from {{ cookiecutter.project_slug }}.users.models import User


@pytest.mark.django_db()
@pytest.mark.django_db
class TestUserManager:
def test_create_user(self):
user = User.objects.create_user(
Expand Down Expand Up @@ -37,7 +37,7 @@ def test_create_superuser_username_ignored(self):
assert user.username is None


@pytest.mark.django_db()
@pytest.mark.django_db
def test_createsuperuser_command():
"""Ensure createsuperuser command works with our custom manager."""
out = StringIO()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_swagger_accessible_by_admin(admin_client):
assert response.status_code == HTTPStatus.OK


@pytest.mark.django_db()
@pytest.mark.django_db
def test_swagger_ui_not_accessible_by_normal_user(client):
url = reverse("api-docs")
response = client.get(url)
Expand Down

0 comments on commit a5e6a15

Please sign in to comment.