Skip to content

Commit

Permalink
Switch to the maintained pytest-lazy-fixtures package
Browse files Browse the repository at this point in the history
`pytest-lazy-fixture` has not been maintained since 2022, and it does
not work properly with pytest-8 anymore [1].  Switch to the maintained
`pytest-lazy-fixtures` replacement.

[1] TvoroG/pytest-lazy-fixture#65
  • Loading branch information
mgorny committed Jul 8, 2024
1 parent 36db865 commit dc3fece
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ psycopg2-binary = "^2.9.3"
pytest = "^6.2.5"
pytest-django = "^4.5.2"
pytest-pythonpath = "^0.7.3"
pytest-lazy-fixture = "^0.6.3"
pytest-lazy-fixtures = "^1.0.7"
pytest-cov = "^3.0.0"
pytz = "^2024.1"
black = "^24.4.2"
Expand Down
20 changes: 10 additions & 10 deletions tests/test_field.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from django.core.exceptions import ValidationError
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf

from timezone_field import TimeZoneField

Expand All @@ -11,12 +11,12 @@
@pytest.mark.parametrize(
"input_tz, output_tz",
[
[lazy_fixture("pst"), lazy_fixture("pst_tz")],
[lazy_fixture("pst_tz"), lazy_fixture("pst_tz")],
[lazy_fixture("gmt"), lazy_fixture("gmt_tz")],
[lazy_fixture("gmt_tz"), lazy_fixture("gmt_tz")],
[lazy_fixture("utc"), lazy_fixture("utc_tz")],
[lazy_fixture("utc_tz"), lazy_fixture("utc_tz")],
[lf("pst"), lf("pst_tz")],
[lf("pst_tz"), lf("pst_tz")],
[lf("gmt"), lf("gmt_tz")],
[lf("gmt_tz"), lf("gmt_tz")],
[lf("utc"), lf("utc_tz")],
[lf("utc_tz"), lf("utc_tz")],
],
)
def test_valid_dst_tz(Model, input_tz, output_tz):
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_valid_blank(Model, pst, tz_opt):


@pytest.mark.django_db
@pytest.mark.parametrize("filter_tz", [lazy_fixture("pst"), lazy_fixture("pst_tz")])
@pytest.mark.parametrize("filter_tz", [lf("pst"), lf("pst_tz")])
def test_string_value_lookup(Model, pst, filter_tz):
Model.objects.create(tz=pst)
qs = Model.objects.filter(tz=filter_tz)
Expand All @@ -64,8 +64,8 @@ def test_string_value_lookup(Model, pst, filter_tz):
@pytest.mark.parametrize(
"input_tz, output_tz",
[
[lazy_fixture("pst"), lazy_fixture("pst_tz")],
[lazy_fixture("pst_tz"), lazy_fixture("pst_tz")],
[lf("pst"), lf("pst_tz")],
[lf("pst_tz"), lf("pst_tz")],
["", None],
[None, None],
],
Expand Down
6 changes: 3 additions & 3 deletions tests/test_form_field.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from django import forms
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf

from timezone_field import TimeZoneFormField

Expand Down Expand Up @@ -39,8 +39,8 @@ def test_form_valid2(Form, gmt, gmt_tz, utc, utc_tz):
@pytest.mark.parametrize(
"tz, tz_invalid_choice",
[
[lazy_fixture("invalid_tz"), None],
[None, lazy_fixture("invalid_tz")],
[lf("invalid_tz"), None],
[None, lf("invalid_tz")],
],
)
def test_form_invalid(Form, tz, tz_invalid_choice):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_model_form_field.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf

pytestmark = pytest.mark.filterwarnings("ignore:Model 'tests._model.*' was already registered.")

Expand Down Expand Up @@ -44,8 +44,8 @@ def test_valid_specify_all(Model, ModelForm, utc, pst, gmt, utc_tz, gmt_tz, pst_
"tz, error_keyword",
[
[None, "required"],
[lazy_fixture("invalid_tz"), "choice"],
[lazy_fixture("uncommon_tz"), "choice"],
[lf("invalid_tz"), "choice"],
[lf("uncommon_tz"), "choice"],
],
)
def test_invalid_not_blank(ModelForm, tz, error_keyword):
Expand Down

0 comments on commit dc3fece

Please sign in to comment.