From 93292f8a47077cb33475e0760d1539333e185bd7 Mon Sep 17 00:00:00 2001 From: WKDV Bot <adm-git+wkdv-bot@ufz.de> Date: Wed, 6 Mar 2024 09:26:00 +0100 Subject: [PATCH] Bump pytest from 7.4.4 to 8.0.2 --- tests/funcs/test_functions.py | 18 ++++++++--------- tests/funcs/test_outlier_detection.py | 29 +++++++++------------------ tests/requirements.txt | 3 +-- 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/tests/funcs/test_functions.py b/tests/funcs/test_functions.py index 8812569ae..e56783568 100644 --- a/tests/funcs/test_functions.py +++ b/tests/funcs/test_functions.py @@ -243,11 +243,10 @@ def test_flagManual(data, field): assert ~unflagged.all() -@pytest.mark.parametrize("dat", [pytest.lazy_fixture("course_1")]) -def test_flagDriftFromNorm(dat): - data = dat(periods=200, peak_level=5, name="field1")[0] - data["field2"] = dat(periods=200, peak_level=10, name="field2")[0]["field2"] - data["field3"] = dat(periods=200, peak_level=100, name="field3")[0]["field3"] +def test_flagDriftFromNorm(course_1): + data = course_1(periods=200, peak_level=5, name="field1")[0] + data["field2"] = course_1(periods=200, peak_level=10, name="field2")[0]["field2"] + data["field3"] = course_1(periods=200, peak_level=100, name="field3")[0]["field3"] fields = ["field1", "field2", "field3"] @@ -261,11 +260,10 @@ def test_flagDriftFromNorm(dat): assert all(qc._flags["field3"] > UNFLAGGED) -@pytest.mark.parametrize("dat", [pytest.lazy_fixture("course_1")]) -def test_flagDriftFromReference(dat): - data = dat(periods=200, peak_level=5, name="field1")[0] - data["field2"] = dat(periods=200, peak_level=10, name="field2")[0]["field2"] - data["field3"] = dat(periods=200, peak_level=100, name="field3")[0]["field3"] +def test_flagDriftFromReference(course_1): + data = course_1(periods=200, peak_level=5, name="field1")[0] + data["field2"] = course_1(periods=200, peak_level=10, name="field2")[0]["field2"] + data["field3"] = course_1(periods=200, peak_level=100, name="field3")[0]["field3"] fields = ["field1", "field2", "field3"] diff --git a/tests/funcs/test_outlier_detection.py b/tests/funcs/test_outlier_detection.py index c8a2a97f7..d23ef30b5 100644 --- a/tests/funcs/test_outlier_detection.py +++ b/tests/funcs/test_outlier_detection.py @@ -53,17 +53,9 @@ def test_flagSpikesBasic(spiky_data): @pytest.mark.slow -@pytest.mark.parametrize( - "dat", - [ - # see test/functs/fixtures.py for the 'course_N' - pytest.lazy_fixture("course_1"), - pytest.lazy_fixture("course_2"), - pytest.lazy_fixture("course_3"), - pytest.lazy_fixture("course_4"), - ], -) -def test_flagSpikesLimitRaise(dat): +@pytest.mark.parametrize("dat", ["course_1", "course_2", "course_3", "course_4"]) +def test_flagSpikesLimitRaise(dat, request): + dat = request.getfixturevalue(dat) data, characteristics = dat() field, *_ = data.columns flags = initFlagsLike(data) @@ -80,8 +72,7 @@ def test_flagSpikesLimitRaise(dat): # see test/functs/fixtures.py for the 'course_N' -@pytest.mark.parametrize("dat", [pytest.lazy_fixture("course_3")]) -def test_flagMVScores(dat): +def test_flagMVScores(course_3): def _check(fields, flags, characteristics): for field in fields: isflagged = flags[field] > UNFLAGGED @@ -89,10 +80,10 @@ def test_flagMVScores(dat): assert not isflagged[characteristics["return"]].any() assert not isflagged[characteristics["drop"]].any() - data1, characteristics = dat( + data1, characteristics = course_3( periods=1000, initial_level=5, final_level=15, out_val=50 ) - data2, characteristics = dat( + data2, characteristics = course_3( periods=1000, initial_level=20, final_level=1, out_val=30 ) fields = ["field1", "field2"] @@ -111,9 +102,8 @@ def test_flagMVScores(dat): _check(fields, qc.flags, characteristics) -@pytest.mark.parametrize("dat", [pytest.lazy_fixture("course_3")]) -def test_grubbs(dat): - data, char_dict = dat( +def test_grubbs(course_3): + data, char_dict = course_3( freq="10min", periods=45, initial_level=0, @@ -127,12 +117,11 @@ def test_grubbs(dat): assert np.all(qc.flags["data"][char_dict["drop"]] > UNFLAGGED) -@pytest.mark.parametrize("dat", [pytest.lazy_fixture("course_2")]) @pytest.mark.parametrize( "parameters", [("standard", 1), ("modified", 1), ("modified", 3), ("standard", "3h")], ) -def test_flagCrossStatistics(dat, parameters): +def test_flagCrossStatistics(parameters): fields = [f"data{i}" for i in range(6)] data = pd.DataFrame( 0, columns=fields, index=pd.date_range("2000", freq="1h", periods=10) diff --git a/tests/requirements.txt b/tests/requirements.txt index fe4007473..af4cf289d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,6 +5,5 @@ beautifulsoup4==4.12.3 hypothesis==6.98.15 Markdown==3.5.2 -pytest==7.4.4 -pytest-lazy-fixture==0.6.3 +pytest==8.0.2 requests==2.31.0 -- GitLab