Skip to content

Commit

Permalink
Merge pull request #12 from uermel/fix_tests
Browse files Browse the repository at this point in the history
Make tests compatible with pytest >= 8.0.0
  • Loading branch information
jojoelfe authored May 16, 2024
2 parents ddd5343 + 1094111 commit 2e752a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ dev = [
"pre-commit",
"pytest-cov",
"pytest",
"pytest-lazy-fixture",
"rich",
"ruff",
"mkdocs-material",
Expand Down Expand Up @@ -104,7 +103,6 @@ extend-ignore = [
[tool.hatch.envs.default]
dependencies = [
"pytest",
"pytest-lazy-fixture",
]

[tool.hatch.envs.default.scripts]
Expand Down
21 changes: 14 additions & 7 deletions tests/test_model_api.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2e752a5

Please sign in to comment.