From 1094111719857e0dfb03bd7ac895d0aadd7509ef Mon Sep 17 00:00:00 2001 From: uermel Date: Wed, 15 May 2024 18:58:57 -0700 Subject: [PATCH] make tests compatible with pytest >= 8.0.0 --- pyproject.toml | 2 -- tests/test_model_api.py | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5b0b0ba..1a98b0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,6 @@ dev = [ "pre-commit", "pytest-cov", "pytest", - "pytest-lazy-fixture", "rich", "ruff", "mkdocs-material", @@ -104,7 +103,6 @@ extend-ignore = [ [tool.hatch.envs.default] dependencies = [ "pytest", - "pytest-lazy-fixture", ] [tool.hatch.envs.default.scripts] diff --git a/tests/test_model_api.py b/tests/test_model_api.py index b190725..b17d4d5 100644 --- a/tests/test_model_api.py +++ b/tests/test_model_api.py @@ -1,19 +1,26 @@ import pytest -from pytest_lazyfixture import lazy_fixture - from imodmodel import ImodModel -from imodmodel.models import Object, ObjectHeader, Contour, ContourHeader, Mesh, MeshHeader +from imodmodel.models import ( + Contour, + ContourHeader, + Mesh, + MeshHeader, + Object, + ObjectHeader, +) + @pytest.mark.parametrize( - "file, meshes_expected", + "file_fixture, meshes_expected", [ - (lazy_fixture('two_contour_model_file'), 0), - (lazy_fixture('meshed_contour_model_file'), 1), + ('two_contour_model_file', 0), + ('meshed_contour_model_file', 1), ] ) -def test_read(file, meshes_expected): +def test_read(file_fixture, meshes_expected, request): """Check the model based API""" + file = request.getfixturevalue(file_fixture) model = ImodModel.from_file(file) assert isinstance(model, ImodModel) assert len(model.objects) == 1