From 329ba8f4fff4186fbc41595cf0b6689d5138520f Mon Sep 17 00:00:00 2001 From: aclerc Date: Fri, 13 Sep 2024 14:38:10 +0100 Subject: [PATCH] use benchmark in test_calc_wsratio_v_wd_scen --- pyproject.toml | 1 + tests/test_detrend.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2e83e4a..e0bade4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ build-backend = "setuptools.build_meta" [project.optional-dependencies] dev = [ 'pytest', + 'pytest-benchmark', 'coverage', 'poethepoet', 'types-pyyaml', diff --git a/tests/test_detrend.py b/tests/test_detrend.py index b158499..6b069cf 100644 --- a/tests/test_detrend.py +++ b/tests/test_detrend.py @@ -66,7 +66,7 @@ def test_check_applied_detrend(test_lsa_t13_config: WindUpConfig) -> None: assert detrend_post_r2_improvement == pytest.approx(0.03776561982402227) -def test_calc_wsratio_v_wd_scen(test_lsa_t13_config: WindUpConfig) -> None: +def test_calc_wsratio_v_wd_scen(benchmark, test_lsa_t13_config: WindUpConfig) -> None: # this test case borrows logic and results from check_applied_detrend where data which has already been detrended # is used to calculate the wsratio_v_wd_scen again to check it is flat cfg = test_lsa_t13_config @@ -85,7 +85,8 @@ def test_calc_wsratio_v_wd_scen(test_lsa_t13_config: WindUpConfig) -> None: expected_pre_df = pd.read_parquet( Path(__file__).parents[0] / "test_data/LSA_T13_LSA_T12_check_pre_wsratio_v_dir_scen.parquet", ) - actual_pre_df = calc_wsratio_v_wd_scen( + actual_pre_df = benchmark( + calc_wsratio_v_wd_scen, test_name=test_name, ref_name=ref_name, ref_lat=ref_lat,