Skip to content

Commit cdef84f

Browse files
authored
Fix ruff PT001 warning (#1204)
1 parent e181bc1 commit cdef84f

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ extend-select = [
154154
ignore = [
155155
"PLR0913", # Too many arguments in function definition
156156
"PLR2004", # Magic value used in comparison, consider replacing 3 with a constant variable
157-
"PT001", # Use `@pytest.fixture()` over `@pytest.fixture`
158157
"PT023", # Use `@pytest.mark.django_db()` over `@pytest.mark.django_db`
159158
]
160159

pytest_django/fixtures.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def django_db_setup(
201201
)
202202

203203

204-
@pytest.fixture()
204+
@pytest.fixture
205205
def _django_db_helper(
206206
request: pytest.FixtureRequest,
207207
django_db_setup: None,
@@ -365,7 +365,7 @@ def _set_suffix_to_test_databases(suffix: str) -> None:
365365
# ############### User visible fixtures ################
366366

367367

368-
@pytest.fixture()
368+
@pytest.fixture
369369
def db(_django_db_helper: None) -> None:
370370
"""Require a django test database.
371371
@@ -382,7 +382,7 @@ def db(_django_db_helper: None) -> None:
382382
# The `_django_db_helper` fixture checks if `db` is requested.
383383

384384

385-
@pytest.fixture()
385+
@pytest.fixture
386386
def transactional_db(_django_db_helper: None) -> None:
387387
"""Require a django test database with transaction support.
388388
@@ -398,7 +398,7 @@ def transactional_db(_django_db_helper: None) -> None:
398398
# The `_django_db_helper` fixture checks if `transactional_db` is requested.
399399

400400

401-
@pytest.fixture()
401+
@pytest.fixture
402402
def django_db_reset_sequences(
403403
_django_db_helper: None,
404404
transactional_db: None,
@@ -414,7 +414,7 @@ def django_db_reset_sequences(
414414
# is requested.
415415

416416

417-
@pytest.fixture()
417+
@pytest.fixture
418418
def django_db_serialized_rollback(
419419
_django_db_helper: None,
420420
db: None,
@@ -435,7 +435,7 @@ def django_db_serialized_rollback(
435435
# is requested.
436436

437437

438-
@pytest.fixture()
438+
@pytest.fixture
439439
def client() -> django.test.Client:
440440
"""A Django test client instance."""
441441
skip_if_no_django()
@@ -445,7 +445,7 @@ def client() -> django.test.Client:
445445
return Client()
446446

447447

448-
@pytest.fixture()
448+
@pytest.fixture
449449
def async_client() -> django.test.AsyncClient:
450450
"""A Django test async client instance."""
451451
skip_if_no_django()
@@ -455,22 +455,22 @@ def async_client() -> django.test.AsyncClient:
455455
return AsyncClient()
456456

457457

458-
@pytest.fixture()
458+
@pytest.fixture
459459
def django_user_model(db: None):
460460
"""The class of Django's user model."""
461461
from django.contrib.auth import get_user_model
462462

463463
return get_user_model()
464464

465465

466-
@pytest.fixture()
466+
@pytest.fixture
467467
def django_username_field(django_user_model) -> str:
468468
"""The fieldname for the username used with Django's user model."""
469469
field: str = django_user_model.USERNAME_FIELD
470470
return field
471471

472472

473-
@pytest.fixture()
473+
@pytest.fixture
474474
def admin_user(
475475
db: None,
476476
django_user_model,
@@ -501,7 +501,7 @@ def admin_user(
501501
return user
502502

503503

504-
@pytest.fixture()
504+
@pytest.fixture
505505
def admin_client(
506506
db: None,
507507
admin_user,
@@ -514,7 +514,7 @@ def admin_client(
514514
return client
515515

516516

517-
@pytest.fixture()
517+
@pytest.fixture
518518
def rf() -> django.test.RequestFactory:
519519
"""RequestFactory instance"""
520520
skip_if_no_django()
@@ -524,7 +524,7 @@ def rf() -> django.test.RequestFactory:
524524
return RequestFactory()
525525

526526

527-
@pytest.fixture()
527+
@pytest.fixture
528528
def async_rf() -> django.test.AsyncRequestFactory:
529529
"""AsyncRequestFactory instance"""
530530
skip_if_no_django()
@@ -569,7 +569,7 @@ def finalize(self) -> None:
569569
del self._to_restore[:]
570570

571571

572-
@pytest.fixture()
572+
@pytest.fixture
573573
def settings():
574574
"""A Django settings object which restores changes after the testrun"""
575575
skip_if_no_django()
@@ -702,13 +702,13 @@ def _assert_num_queries(
702702
pytest.fail(msg)
703703

704704

705-
@pytest.fixture()
705+
@pytest.fixture
706706
def django_assert_num_queries(pytestconfig: pytest.Config) -> DjangoAssertNumQueries:
707707
"""Allows to check for an expected number of DB queries."""
708708
return partial(_assert_num_queries, pytestconfig)
709709

710710

711-
@pytest.fixture()
711+
@pytest.fixture
712712
def django_assert_max_num_queries(pytestconfig: pytest.Config) -> DjangoAssertNumQueries:
713713
"""Allows to check for an expected maximum number of DB queries."""
714714
return partial(_assert_num_queries, pytestconfig, exact=False)
@@ -726,7 +726,7 @@ def __call__(
726726
pass # pragma: no cover
727727

728728

729-
@pytest.fixture()
729+
@pytest.fixture
730730
def django_capture_on_commit_callbacks() -> DjangoCaptureOnCommitCallbacks:
731731
"""Captures transaction.on_commit() callbacks for the given database connection."""
732732
from django.test import TestCase

pytest_django/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def _dj_autoclear_mailbox() -> None:
605605
mail.outbox.clear()
606606

607607

608-
@pytest.fixture()
608+
@pytest.fixture
609609
def mailoutbox(
610610
django_mail_patch_dns: None,
611611
_dj_autoclear_mailbox: None,
@@ -620,7 +620,7 @@ def mailoutbox(
620620
return []
621621

622622

623-
@pytest.fixture()
623+
@pytest.fixture
624624
def django_mail_patch_dns(
625625
monkeypatch: pytest.MonkeyPatch,
626626
django_mail_dnsname: str,
@@ -631,7 +631,7 @@ def django_mail_patch_dns(
631631
monkeypatch.setattr(mail.message, "DNS_NAME", django_mail_dnsname)
632632

633633

634-
@pytest.fixture()
634+
@pytest.fixture
635635
def django_mail_dnsname() -> str:
636636
"""Return server dns name for using in email messages."""
637637
return "fake-tests.example.com"

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def pytester(pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch) -> pyte
4646
return pytester
4747

4848

49-
@pytest.fixture()
49+
@pytest.fixture
5050
def django_pytester(
5151
request: pytest.FixtureRequest,
5252
pytester: pytest.Pytester,

0 commit comments

Comments
 (0)