CodSpeedHQ / pytest-codspeed

Pytest plugin to create CodSpeed benchmarks
https://codspeed.io
MIT License
58 stars 7 forks source link

TypeError: codspeed_benchmark.<locals>.run() got an unexpected keyword argument 'c' #3

Closed messense closed 1 year ago

messense commented 1 year ago

I was trying to run https://github.com/PyO3/pyo3/tree/main/pytests benchmarks locally with codspeed and run into this error.

With this patch

diff --git a/examples/word-count/requirements-dev.txt b/examples/word-count/requirements-dev.txt
index fcd8fc54c..7a597ac2a 100644
--- a/examples/word-count/requirements-dev.txt
+++ b/examples/word-count/requirements-dev.txt
@@ -1,2 +1,3 @@
 pytest>=3.5.0
 pytest-benchmark>=3.1.1
+pytest-codspeed>=1.2.0
diff --git a/pytests/requirements-dev.txt b/pytests/requirements-dev.txt
index d1fa05414..f971f2724 100644
--- a/pytests/requirements-dev.txt
+++ b/pytests/requirements-dev.txt
@@ -1,4 +1,5 @@
 hypothesis>=3.55
 pytest>=6.0
 pytest-benchmark>=3.4
+pytest-codspeed>=1.2.0
 psutil>=5.6

In pytests directory, run nox -s bench -- --codspeed to reproduce.

benchmark = <function codspeed_benchmark.<locals>.run at 0x10638e830>

    def test_simple_py(benchmark):
>       benchmark(simple_py, 1, "foo", c={1: 2})
E       TypeError: codspeed_benchmark.<locals>.run() got an unexpected keyword argument 'c'

tests/test_deprecated_pyfunctions.py:24: TypeError
art049 commented 1 year ago

Thanks for the bug report @messense. It should work fine now !