From 0f5f667fa6adf65bdaa092bbe199a941acc1fa7c Mon Sep 17 00:00:00 2001 From: Julian Gilbey Date: Sat, 10 Aug 2024 03:03:58 +0100 Subject: [PATCH] Move to pytest-lazy-fixtures (#608) * 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 --------- Co-authored-by: Julian Gilbey Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Loria --- pyproject.toml | 3 +-- tests/test_sqlalchemy_schema.py | 41 +++++++++++++++++---------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 29454947..41b7beff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/tests/test_sqlalchemy_schema.py b/tests/test_sqlalchemy_schema.py index d4d57a48..b9dff393 100644 --- a/tests/test_sqlalchemy_schema.py +++ b/tests/test_sqlalchemy_schema.py @@ -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 @@ -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): @@ -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): @@ -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): @@ -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): @@ -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): @@ -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): @@ -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):