Skip to content

Commit

Permalink
Move to pytest-lazy-fixtures (#608)
Browse files Browse the repository at this point in the history
* Move to pytest-lazy-fixtures

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Force pytest version to be <9

Co-authored-by: Steven Loria <[email protected]>

---------

Co-authored-by: Julian Gilbey <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
4 people authored Aug 10, 2024
1 parent ee9932e commit 0f5f667
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Source = "https://github.com/marshmallow-code/marshmallow-sqlalchemy"

[project.optional-dependencies]
docs = ["sphinx==7.4.5", "alabaster==1.0.0", "sphinx-issues==4.1.0"]
# TODO: Remove pytest pin when https://github.com/TvoroG/pytest-lazy-fixture/issues/65 is resolved
tests = ["pytest<8", "pytest-lazy-fixture>=0.6.2"]
tests = ["pytest<9", "pytest-lazy-fixtures"]
dev = ["marshmallow-sqlalchemy[tests]", "tox", "pre-commit~=3.5"]

[build-system]
Expand Down
41 changes: 21 additions & 20 deletions tests/test_sqlalchemy_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
import sqlalchemy as sa
from marshmallow import Schema, ValidationError, validate
from pytest_lazy_fixtures import lf

from marshmallow_sqlalchemy import SQLAlchemyAutoSchema, SQLAlchemySchema, auto_field
from marshmallow_sqlalchemy.exceptions import IncorrectSchemaTypeError
Expand Down Expand Up @@ -125,8 +126,8 @@ class Meta:
@pytest.mark.parametrize(
"schema",
(
pytest.lazy_fixture("sqla_schema_with_relationships"),
pytest.lazy_fixture("sqla_auto_model_schema_with_relationships"),
lf("sqla_schema_with_relationships"),
lf("sqla_auto_model_schema_with_relationships"),
),
)
def test_dump_with_relationships(teacher, schema):
Expand All @@ -141,8 +142,8 @@ def test_dump_with_relationships(teacher, schema):
@pytest.mark.parametrize(
"schema",
(
pytest.lazy_fixture("sqla_schema_with_fks"),
pytest.lazy_fixture("sqla_auto_model_schema_with_fks"),
lf("sqla_schema_with_fks"),
lf("sqla_auto_model_schema_with_fks"),
),
)
def test_dump_with_foreign_keys(teacher, schema):
Expand All @@ -163,10 +164,10 @@ def test_table_schema_dump(teacher, sqla_auto_table_schema):
@pytest.mark.parametrize(
"schema",
(
pytest.lazy_fixture("sqla_schema_with_relationships"),
pytest.lazy_fixture("sqla_schema_with_fks"),
pytest.lazy_fixture("sqla_auto_model_schema"),
pytest.lazy_fixture("sqla_auto_table_schema"),
lf("sqla_schema_with_relationships"),
lf("sqla_schema_with_fks"),
lf("sqla_auto_model_schema"),
lf("sqla_auto_table_schema"),
),
)
def test_load(schema):
Expand Down Expand Up @@ -217,10 +218,10 @@ class Meta(auto_schema_no_load_instance.Meta):
@pytest.mark.parametrize(
"Schema",
(
pytest.lazy_fixture("schema_no_load_instance"),
pytest.lazy_fixture("schema_with_load_instance"),
pytest.lazy_fixture("auto_schema_no_load_instance"),
pytest.lazy_fixture("auto_schema_with_load_instance"),
lf("schema_no_load_instance"),
lf("schema_with_load_instance"),
lf("auto_schema_no_load_instance"),
lf("auto_schema_with_load_instance"),
),
)
def test_toggle_load_instance_per_schema(self, models, Schema):
Expand All @@ -246,10 +247,10 @@ def test_toggle_load_instance_per_schema(self, models, Schema):
@pytest.mark.parametrize(
"schema",
(
pytest.lazy_fixture("sqla_schema_with_relationships"),
pytest.lazy_fixture("sqla_schema_with_fks"),
pytest.lazy_fixture("sqla_auto_model_schema"),
pytest.lazy_fixture("sqla_auto_table_schema"),
lf("sqla_schema_with_relationships"),
lf("sqla_schema_with_fks"),
lf("sqla_auto_model_schema"),
lf("sqla_auto_table_schema"),
),
)
def test_load_validation_errors(schema):
Expand Down Expand Up @@ -373,8 +374,8 @@ class Meta:
@pytest.mark.parametrize(
"schema",
(
pytest.lazy_fixture("aliased_schema"),
pytest.lazy_fixture("aliased_auto_schema"),
lf("aliased_schema"),
lf("aliased_auto_schema"),
),
)
def test_passing_column_name(self, schema, teacher):
Expand Down Expand Up @@ -417,8 +418,8 @@ class Meta:
@pytest.mark.parametrize(
"SchemaClass",
(
pytest.lazy_fixture("sqla_schema_class"),
pytest.lazy_fixture("sqla_auto_schema_class"),
lf("sqla_schema_class"),
lf("sqla_auto_schema_class"),
),
)
def test_load(self, teacher, SchemaClass, models):
Expand Down

0 comments on commit 0f5f667

Please sign in to comment.