From 4521543506b42c842e6e5db5ba193f1eeaa4eb03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 23:55:29 +0000 Subject: [PATCH 1/4] Bump pytest from 7.4.4 to 8.0.0 in /requirements Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.4 to 8.0.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.4...8.0.0) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index c1da15e28..0856f2dff 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -27,7 +27,7 @@ pre-commit==3.6.0 protobuf>=3.19.5 # not directly required, pinned by Snyk to avoid a vulnerability. psutil==5.9.8 pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability. -pytest==7.4.4 +pytest==8.0.0 pytest-cov==4.1.0 pytest-lazy-fixture==0.6.3 pyyaml==6.0.1 From e8daa4e639bedf4414c4831db32ee6b416bd7e08 Mon Sep 17 00:00:00 2001 From: Harry Baker Date: Fri, 13 Sep 2024 16:53:58 +0100 Subject: [PATCH 2/4] Bump `pytest` --> `8.3.3`, `pytest-cov` --> `5.0.0` --- requirements/requirements_dev.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index be60d6c22..157c4023b 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -25,8 +25,8 @@ pre-commit==3.8.0 protobuf>=3.19.5 # not directly required, pinned by Snyk to avoid a vulnerability. psutil==6.0.0 pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability. -pytest==8.0.0 -pytest-cov==4.1.0 +pytest==8.3.3 +pytest-cov==5.0.0 pytest-lazy-fixture==0.6.3 pyyaml==6.0.1 rasterio>=1.3.6 From e469d57ec5570e5b09304cb3d13bbb820d814f86 Mon Sep 17 00:00:00 2001 From: Harry Baker Date: Mon, 14 Oct 2024 22:59:39 +0100 Subject: [PATCH 3/4] Use `pytest-lazy-fixtures` rather than `pytest-lazy-fixture` --- requirements/requirements_dev.txt | 2 +- tests/test_models/test_core.py | 14 +++++++------- tests/test_transforms.py | 24 +++++++++++------------- tests/test_utils/test_utils.py | 4 ++-- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index 5e1e16820..4c9b151f2 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -8,7 +8,7 @@ pre-commit==3.8.0 pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability. 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 diff --git a/tests/test_models/test_core.py b/tests/test_models/test_core.py index 92eae695c..e486373b7 100644 --- a/tests/test_models/test_core.py +++ b/tests/test_models/test_core.py @@ -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. @@ -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), ], ) @@ -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), ], ) @@ -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: diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 857e305c6..10731563a 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -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 @@ -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]]), @@ -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() @@ -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]] ), @@ -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"), ), ], ) @@ -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) diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index 9512bc535..ad3aaaced 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -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 @@ -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"), ), ], ) From e6b9bd8a0b83087777c56055668136b884b64f2f Mon Sep 17 00:00:00 2001 From: Harry Baker Date: Mon, 14 Oct 2024 23:03:06 +0100 Subject: [PATCH 4/4] Bump `tox` --> `4.21.2` --- pyproject.toml | 2 +- requirements/requirements_dev.txt | 2 +- setup.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0ce1f150e..2c6117ddd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ test = [ "mypy", "pytest", "pytest-cov", - "pytest-lazy-fixture", + "pytest-lazy-fixtures", "tox", ] diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index 4c9b151f2..123b1b456 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -11,4 +11,4 @@ pytest-cov==5.0.0 pytest-lazy-fixtures==1.1.1 sphinx==7.4.4 sphinx-rtd-theme==2.0.0 -tox==4.18.0 +tox==4.21.2 diff --git a/setup.cfg b/setup.cfg index f0cfc3799..1c9be3bf0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -68,7 +68,7 @@ test = mypy pytest pytest-cov - pytest-lazy-fixture + pytest-lazy-fixtures tox