From eeee795c232e2811adeb5a3942f7a149d8b16d49 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 18 Jan 2024 15:59:40 -0800 Subject: [PATCH] fix benchmarks compatibility with newer pytest-cases (#14764) Reverts changes from #14756. * updates `cudf`'s tests to be compatible with the latest `pytest-cases` ([version 3.8.2](https://pypi.org/project/pytest-cases/#history)) * puts a floor of `pytest-cases>=3.8.2` on that project to be sure older versions aren't used Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Matthew Roeschke (https://github.com/mroeschke) - Vyas Ramasubramani (https://github.com/vyasr) - Ray Douglass (https://github.com/raydouglass) URL: https://github.com/rapidsai/cudf/pull/14764 --- conda/environments/all_cuda-118_arch-x86_64.yaml | 2 +- conda/environments/all_cuda-120_arch-x86_64.yaml | 2 +- dependencies.yaml | 2 +- python/cudf/benchmarks/API/bench_dataframe.py | 6 ++++-- python/cudf/benchmarks/API/bench_functions.py | 6 ++++-- .../API/{bench_dataframe_cases.py => cases_dataframe.py} | 2 +- .../API/{bench_functions_cases.py => cases_functions.py} | 2 +- python/cudf/pyproject.toml | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) rename python/cudf/benchmarks/API/{bench_dataframe_cases.py => cases_dataframe.py} (88%) rename python/cudf/benchmarks/API/{bench_functions_cases.py => cases_functions.py} (99%) diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 15bcf207b1b..47b377013ce 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -75,7 +75,7 @@ dependencies: - pydata-sphinx-theme!=0.14.2 - pytest - pytest-benchmark -- pytest-cases<3.8.2 +- pytest-cases>=3.8.2 - pytest-cov - pytest-xdist - python-confluent-kafka>=1.9.0,<1.10.0a0 diff --git a/conda/environments/all_cuda-120_arch-x86_64.yaml b/conda/environments/all_cuda-120_arch-x86_64.yaml index ccad6a366fb..de59bc1d43c 100644 --- a/conda/environments/all_cuda-120_arch-x86_64.yaml +++ b/conda/environments/all_cuda-120_arch-x86_64.yaml @@ -72,7 +72,7 @@ dependencies: - pydata-sphinx-theme!=0.14.2 - pytest - pytest-benchmark -- pytest-cases<3.8.2 +- pytest-cases>=3.8.2 - pytest-cov - pytest-xdist - python-confluent-kafka>=1.9.0,<1.10.0a0 diff --git a/dependencies.yaml b/dependencies.yaml index 1c6d5086bf3..9cf808907ec 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -620,7 +620,7 @@ dependencies: - fastavro>=0.22.9 - hypothesis - pytest-benchmark - - pytest-cases<3.8.2 + - pytest-cases>=3.8.2 - python-snappy>=0.6.0 - scipy - output_types: conda diff --git a/python/cudf/benchmarks/API/bench_dataframe.py b/python/cudf/benchmarks/API/bench_dataframe.py index f908a995c2a..59d73015962 100644 --- a/python/cudf/benchmarks/API/bench_dataframe.py +++ b/python/cudf/benchmarks/API/bench_dataframe.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Benchmarks of DataFrame methods.""" @@ -178,6 +178,8 @@ def bench_nsmallest(benchmark, dataframe, num_cols_to_sort, n): benchmark(dataframe.nsmallest, n, by) -@pytest_cases.parametrize_with_cases("dataframe, cond, other", prefix="where") +@pytest_cases.parametrize_with_cases( + "dataframe, cond, other", prefix="where", cases="cases_dataframe" +) def bench_where(benchmark, dataframe, cond, other): benchmark(dataframe.where, cond, other) diff --git a/python/cudf/benchmarks/API/bench_functions.py b/python/cudf/benchmarks/API/bench_functions.py index ec4be221d9f..93109838900 100644 --- a/python/cudf/benchmarks/API/bench_functions.py +++ b/python/cudf/benchmarks/API/bench_functions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Benchmarks of free functions that accept cudf objects.""" @@ -9,7 +9,9 @@ from utils import benchmark_with_object -@pytest_cases.parametrize_with_cases("objs", prefix="concat") +@pytest_cases.parametrize_with_cases( + "objs", prefix="concat", cases="cases_functions" +) @pytest.mark.parametrize( "axis", [ diff --git a/python/cudf/benchmarks/API/bench_dataframe_cases.py b/python/cudf/benchmarks/API/cases_dataframe.py similarity index 88% rename from python/cudf/benchmarks/API/bench_dataframe_cases.py rename to python/cudf/benchmarks/API/cases_dataframe.py index fc41d141c8a..d12b9776f1b 100644 --- a/python/cudf/benchmarks/API/bench_dataframe_cases.py +++ b/python/cudf/benchmarks/API/cases_dataframe.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. from utils import benchmark_with_object diff --git a/python/cudf/benchmarks/API/bench_functions_cases.py b/python/cudf/benchmarks/API/cases_functions.py similarity index 99% rename from python/cudf/benchmarks/API/bench_functions_cases.py rename to python/cudf/benchmarks/API/cases_functions.py index c81f8f20f80..6bc66aa4a9b 100644 --- a/python/cudf/benchmarks/API/bench_functions_cases.py +++ b/python/cudf/benchmarks/API/cases_functions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. """Test cases for benchmarks in bench_functions.py.""" diff --git a/python/cudf/pyproject.toml b/python/cudf/pyproject.toml index 18771804f61..c7b66abea27 100644 --- a/python/cudf/pyproject.toml +++ b/python/cudf/pyproject.toml @@ -59,7 +59,7 @@ test = [ "msgpack", "pytest", "pytest-benchmark", - "pytest-cases<3.8.2", + "pytest-cases>=3.8.2", "pytest-cov", "pytest-xdist", "python-snappy>=0.6.0",