Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pytest from 7.4.4 to 8.0.0 in /requirements #429

Merged
merged 9 commits into from
Oct 15, 2024
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test = [
"mypy",
"pytest",
"pytest-cov",
"pytest-lazy-fixture",
"pytest-lazy-fixtures",
"tox",
]

Expand Down
6 changes: 3 additions & 3 deletions requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ mypy==1.11.2
myst_parser==4.0.0
pre-commit==3.8.0
pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability.
pytest==7.4.4
pytest==8.3.3
pytest-cov==5.0.0
pytest-lazy-fixture==0.6.3
pytest-lazy-fixtures==1.1.1
sphinx==7.4.4
sphinx-rtd-theme==2.0.0
tox==4.18.0
tox==4.21.2
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test =
mypy
pytest
pytest-cov
pytest-lazy-fixture
pytest-lazy-fixtures
tox


Expand Down
14 changes: 7 additions & 7 deletions tests/test_models/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import packaging
import pytest
import torch
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from urllib3.exceptions import MaxRetryError, NewConnectionError

# Needed to avoid connection error when importing lightly.
Expand Down Expand Up @@ -194,8 +194,8 @@ def test_bilinear_init() -> None:
@pytest.mark.parametrize(
("model", "answer"),
[
(lazy_fixture("exp_fcn"), True),
(lazy_fixture("exp_cnn"), True),
(lf("exp_fcn"), True),
(lf("exp_cnn"), True),
(resnet18(), False),
],
)
Expand All @@ -214,9 +214,9 @@ def test_is_minerva_model(model: Module, compile_model: bool, answer: bool) -> N
@pytest.mark.parametrize(
("model", "subtype", "answer"),
[
(lazy_fixture("exp_fcn"), MinervaBackbone, True),
(lazy_fixture("exp_cnn"), MinervaSiamese, False),
(lazy_fixture("exp_simconv"), MinervaSiamese, True),
(lf("exp_fcn"), MinervaBackbone, True),
(lf("exp_cnn"), MinervaSiamese, False),
(lf("exp_simconv"), MinervaSiamese, True),
(resnet18(), MinervaBackbone, False),
],
)
Expand All @@ -236,7 +236,7 @@ def test_is_minerva_subtype(

@pytest.mark.parametrize(
"model",
(lazy_fixture("exp_fcn"), lazy_fixture("exp_cnn"), lazy_fixture("exp_simconv")),
(lf("exp_fcn"), lf("exp_cnn"), lf("exp_simconv")),
)
@pytest.mark.parametrize("compile_model", (True, False))
def test_extract_wrapped_model(model, compile_model: bool) -> None:
Expand Down
24 changes: 11 additions & 13 deletions tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import pytest
import torch
from numpy.testing import assert_array_equal
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from torch import FloatTensor, LongTensor
from torchgeo.datasets import RasterDataset
from torchvision.transforms import ColorJitter, RandomHorizontalFlip, RandomVerticalFlip
Expand Down Expand Up @@ -69,7 +69,7 @@
@pytest.mark.parametrize(
["input_mask", "output"],
[
(lazy_fixture("simple_mask"), torch.tensor([[1, 3, 0], [2, 0, 1], [1, 1, 1]])),
(lf("simple_mask"), torch.tensor([[1, 3, 0], [2, 0, 1], [1, 1, 1]])),
(
torch.tensor([[5, 3, 5], [4, 5, 1], [1, 3, 1]], dtype=torch.long),
torch.tensor([[0, 3, 0], [2, 0, 1], [1, 3, 1]]),
Expand All @@ -86,9 +86,7 @@ def test_class_transform(
assert repr(transform) == f"ClassTransform(transform={example_matrix})"


@pytest.mark.parametrize(
"sample", (42, lazy_fixture("simple_mask"), lazy_fixture("example_matrix"))
)
@pytest.mark.parametrize("sample", (42, lf("simple_mask"), lf("example_matrix")))
def test_pair_create(sample: Any) -> None:
transform = PairCreate()

Expand All @@ -100,7 +98,7 @@ def test_pair_create(sample: Any) -> None:
@pytest.mark.parametrize(
"mask",
(
lazy_fixture("simple_mask"),
lf("simple_mask"),
torch.tensor(
[[1023.0, 3.890, 557.0], [478.0, 5.788, 10009.0], [1.0, 10240.857, 1458.7]]
),
Expand Down Expand Up @@ -256,22 +254,22 @@ def test_dublicator(
Normalise,
None,
255,
lazy_fixture("simple_rgb_img"),
lazy_fixture("norm_simple_rgb_img"),
lf("simple_rgb_img"),
lf("norm_simple_rgb_img"),
),
(
Normalise,
["image"],
255,
lazy_fixture("simple_rgb_img"),
lazy_fixture("norm_simple_rgb_img"),
lf("simple_rgb_img"),
lf("norm_simple_rgb_img"),
),
(
RandomHorizontalFlip,
["image", "mask"],
1.0,
lazy_fixture("simple_sample"),
lazy_fixture("flipped_simple_sample"),
lf("simple_sample"),
lf("flipped_simple_sample"),
),
],
)
Expand Down Expand Up @@ -349,7 +347,7 @@ def test_swap_keys(random_rgbi_tensor, random_tensor_mask) -> None:

@pytest.mark.parametrize(
"dataset",
[lazy_fixture("default_image_dataset"), lazy_fixture("ssl4eo_s12_dataset")],
[lf("default_image_dataset"), lf("ssl4eo_s12_dataset")],
)
def test_auto_norm(dataset: RasterDataset, random_rgbi_tensor):
auto_norm = AutoNorm(dataset, 12)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from internet_sabotage import no_connection
from nptyping import Float, NDArray, Shape
from numpy.testing import assert_array_equal
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from rasterio.crs import CRS
from torchgeo.datasets.utils import BoundingBox, stack_samples
from torchvision.datasets import FakeData
Expand Down Expand Up @@ -241,7 +241,7 @@ def test_eliminate_classes(
[2, 1, 5, 1, 6, 3, 0, 1, 1, 5, 7],
[2, 4, 5, 1, 6, 3, 0, 2, 1, 5, 7],
[2, 1, 5, 1, 6, 3, 0, 1, 1, 5, 7],
lazy_fixture("exp_classes"),
lf("exp_classes"),
),
],
)
Expand Down
Loading