From 5ffc9e1314b598a8ff09a53316b778ad0d854745 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:37:49 +0100 Subject: [PATCH 1/8] update: rename fixtures used in lazy_fixture --- julearn/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/julearn/conftest.py b/julearn/conftest.py index 8b074b789..77b7a71cc 100644 --- a/julearn/conftest.py +++ b/julearn/conftest.py @@ -131,7 +131,7 @@ def X_types_iris(request: FixtureRequest) -> Optional[Dict]: @fixture(params=["rf", "svm", "gauss", "ridge"], scope="function") -def models_all_problem_types(request: FixtureRequest) -> str: +def model(request: FixtureRequest) -> str: """Return different models that work with classification and regression. Parameters @@ -149,7 +149,7 @@ def models_all_problem_types(request: FixtureRequest) -> str: @fixture(params=["regression", "classification"], scope="function") -def all_problem_types(request: FixtureRequest) -> str: +def problem_type(request: FixtureRequest) -> str: """Return different problem types. Parameters @@ -245,7 +245,7 @@ def get(step: str) -> Dict: ], scope="function", ) -def preprocessing(request: FixtureRequest) -> Union[str, List[str]]: +def preprocess(request: FixtureRequest) -> Union[str, List[str]]: """Return different preprocessing steps. Parameters From 607f55c1bc14048dd7d290651a41a0a327de5964 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:39:19 +0100 Subject: [PATCH 2/8] chore: update problem_type docstring --- julearn/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/julearn/conftest.py b/julearn/conftest.py index 77b7a71cc..a331f6388 100644 --- a/julearn/conftest.py +++ b/julearn/conftest.py @@ -160,7 +160,7 @@ def problem_type(request: FixtureRequest) -> str: Returns ------- str - The problem type (one of {"regression", "classification"}). + The problem type. """ From 0230619e2d7e81dc150b036486fa6f431d2e1031 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:39:44 +0100 Subject: [PATCH 3/8] update: rename fixture used in lazy_fixture for deslib tests --- julearn/models/tests/test_dynamic.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/julearn/models/tests/test_dynamic.py b/julearn/models/tests/test_dynamic.py index 9393639f9..ecc90a1e0 100644 --- a/julearn/models/tests/test_dynamic.py +++ b/julearn/models/tests/test_dynamic.py @@ -12,7 +12,6 @@ import pandas as pd import pytest from pytest import FixtureRequest, fixture -from pytest_lazyfixture import lazy_fixture from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import ShuffleSplit, train_test_split @@ -64,7 +63,7 @@ ], scope="module", ) -def all_deslib_algorithms(request: FixtureRequest) -> str: +def algo_name(request: FixtureRequest) -> str: """Return different algorithms for the iris dataset features. Parameters @@ -81,10 +80,6 @@ def all_deslib_algorithms(request: FixtureRequest) -> str: return request.param -@pytest.mark.parametrize( - "algo_name", - [lazy_fixture("all_deslib_algorithms")], -) @pytest.mark.skip("Deslib is not compatible with new python. Waiting for PR.") def test_algorithms( df_iris: pd.DataFrame, From dccfa8ff292fa6ad0e9b3926912c6c954eea3f10 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:41:17 +0100 Subject: [PATCH 4/8] chore: remove lazy_fixture usage from pipeline creator tests --- .../pipeline/test/test_pipeline_creator.py | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/julearn/pipeline/test/test_pipeline_creator.py b/julearn/pipeline/test/test_pipeline_creator.py index 4b7f36c7d..f877b74dd 100644 --- a/julearn/pipeline/test/test_pipeline_creator.py +++ b/julearn/pipeline/test/test_pipeline_creator.py @@ -9,7 +9,6 @@ import pandas as pd import pytest -from pytest_lazyfixture import lazy_fixture from sklearn.dummy import DummyClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV, RandomizedSearchCV @@ -23,14 +22,6 @@ from julearn.transformers import get_transformer -@pytest.mark.parametrize( - "model,preprocess,problem_type", - [ - lazy_fixture( - ["models_all_problem_types", "preprocessing", "all_problem_types"] - ) - ], -) def test_construction_working( model: str, preprocess: List[str], problem_type: str ) -> None: @@ -77,14 +68,6 @@ def test_construction_working( assert len(preprocess) + 2 == len(pipeline.steps) -@pytest.mark.parametrize( - "model,preprocess,problem_type", - [ - lazy_fixture( - ["models_all_problem_types", "preprocessing", "all_problem_types"] - ) - ], -) def test_fit_and_transform_no_error( X_iris: pd.DataFrame, # noqa: N803 y_iris: pd.Series, @@ -117,14 +100,6 @@ def test_fit_and_transform_no_error( pipeline[:-1].transform(X_iris) -@pytest.mark.parametrize( - "model,preprocess,problem_type", - [ - lazy_fixture( - ["models_all_problem_types", "preprocessing", "all_problem_types"] - ), - ], -) def test_hyperparameter_tuning( X_types_iris: Dict[str, List[str]], # noqa: N803 model: str, From 9d23c9a9f90108c2b8bb032056e65b337fded03d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:43:14 +0100 Subject: [PATCH 5/8] chore: update type annotations and docstring in test_pipeline_creator.py --- julearn/pipeline/test/test_pipeline_creator.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/julearn/pipeline/test/test_pipeline_creator.py b/julearn/pipeline/test/test_pipeline_creator.py index f877b74dd..f0918aa17 100644 --- a/julearn/pipeline/test/test_pipeline_creator.py +++ b/julearn/pipeline/test/test_pipeline_creator.py @@ -5,7 +5,7 @@ # License: AGPL import warnings -from typing import Callable, Dict, List +from typing import Callable, Dict, List, Union import pandas as pd import pytest @@ -23,7 +23,7 @@ def test_construction_working( - model: str, preprocess: List[str], problem_type: str + model: str, preprocess: Union[str, List[str]], problem_type: str ) -> None: """Test that the pipeline constructions works as expected. @@ -31,7 +31,7 @@ def test_construction_working( ---------- model : str The model to test. - preprocess : List[str] + preprocess : str or list of str The preprocessing steps to test. problem_type : str The problem type to test. @@ -72,7 +72,7 @@ def test_fit_and_transform_no_error( X_iris: pd.DataFrame, # noqa: N803 y_iris: pd.Series, model: str, - preprocess: List[str], + preprocess: Union[str, List[str]], problem_type: str, ) -> None: """Test that the pipeline fit and transform does not give an error. @@ -85,7 +85,7 @@ def test_fit_and_transform_no_error( The iris dataset target variable. model : str The model to test. - preprocess : List[str] + preprocess : str or list of str The preprocessing steps to test. problem_type : str The problem type to test. @@ -103,7 +103,7 @@ def test_fit_and_transform_no_error( def test_hyperparameter_tuning( X_types_iris: Dict[str, List[str]], # noqa: N803 model: str, - preprocess: List[str], + preprocess: Union[str, List[str]], problem_type: str, get_tuning_params: Callable, search_params: Dict[str, List], @@ -112,11 +112,11 @@ def test_hyperparameter_tuning( Parameters ---------- - X_types_iris : Dict[str, List[str]] + X_types_iris : dict The iris dataset features types. model : str The model to test. - preprocess : List[str] + preprocess : str or list of str The preprocessing steps to test. problem_type : str The problem type to test. From dd39bf6f0fa4050831b3cb35af576bcb0ce574e6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 14:44:19 +0100 Subject: [PATCH 6/8] chore: improve tox.ini --- tox.ini | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tox.ini b/tox.ini index 25bde3cb4..4ff2a08a2 100644 --- a/tox.ini +++ b/tox.ini @@ -12,13 +12,7 @@ python = [testenv] skip_install = false deps = - pytest<8.0.0 - pytest-lazy-fixture - seaborn - deslib - panel>=1.0.0b1 - bokeh>=3.0.0 - param + pytest commands = pytest @@ -39,8 +33,7 @@ commands = [testenv:test] skip_install = false deps = - pytest<8.0.0 - pytest-lazy-fixture + pytest seaborn deslib panel>=1.0.0b1 @@ -52,8 +45,7 @@ commands = [testenv:coverage] skip_install = false deps = - pytest<8.0.0 - pytest-lazy-fixture + pytest pytest-cov seaborn deslib From 7134b154a1cbcc893acbcf31f33d179fdff35005 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 15:01:29 +0100 Subject: [PATCH 7/8] chore: revert seaborn as dependency for base tox testenv --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 4ff2a08a2..a17da50a4 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ python = skip_install = false deps = pytest + seaborn commands = pytest From 73e8dab02a15d27fce7ce0feba4ada724f70de92 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 13 Feb 2024 15:06:24 +0100 Subject: [PATCH 8/8] chore: add changelog 251.misc --- docs/changes/newsfragments/251.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/251.misc diff --git a/docs/changes/newsfragments/251.misc b/docs/changes/newsfragments/251.misc new file mode 100644 index 000000000..c611f7f11 --- /dev/null +++ b/docs/changes/newsfragments/251.misc @@ -0,0 +1 @@ +Remove ``pytest-lazy-fixture`` and enable support for ``pytest >= 8.0.0`` by `Synchon Mandal`_