From d87167eb990589194c7b1da1ec71fbc563fae9b9eea0fd1c0316b1222b6cfce7 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 25 Nov 2024 12:43:50 +0000 Subject: [PATCH 1/3] - update to 5.1.0: * Fixed broken hooks handling on pytest 8.1 or later (the TypeError: import_path() missing 1 required keyword-only argument: 'consider_namespace_packages' issue). Unfortunately this sets the minimum supported pytest version to 8.1. * Fixed bad fixture check that broke down then nbmake was enabled. * Dropped support for now EOL Python 3.8. Also moved tests suite to only test the latest pytest versions (8.3.x). * Fix generate parametrize tests benchmark csv report errors (issue #268). Contributed by Johnny Huang in #269. * Added the --benchmark-time-unit cli option for overriding the measurement unit used for display. Contributed by Tony Kuo in #257. * Fixes spelling in some help texts. Contributed by Eugeniy in #267. * Added new cprofile options: --benchmark-cprofile-loops=LOOPS - previously profiling only ran the function once, this allow customization. --benchmark-cprofile-top=COUNT - allows showing more rows. --benchmark-cprofile-dump=[FILENAME- PREFIX] - allows saving to a file (that you can load in snakeviz, RunSnakeRun or other tools). * --benchmark-cprofile-loops=LOOPS - previously profiling only ran the function once, this allow customization. * --benchmark-cprofile-top=COUNT - allows showing more rows. * --benchmark-cprofile-dump=[FILENAME-PREFIX] - allows saving to a file (that you can load in snakeviz, RunSnakeRun or other tools). * Removed hidden dependency on py.path (replaced with pathlib). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-benchmark?expand=0&rev=32 --- fix-test-fast.patch | 22 ---------------- py311.patch | 45 --------------------------------- pytest-benchmark-4.0.0.tar.gz | 3 --- pytest-benchmark-5.1.0.tar.gz | 3 +++ python-pytest-benchmark.changes | 34 +++++++++++++++++++++++++ python-pytest-benchmark.spec | 8 +++--- 6 files changed, 40 insertions(+), 75 deletions(-) delete mode 100644 fix-test-fast.patch delete mode 100644 py311.patch delete mode 100644 pytest-benchmark-4.0.0.tar.gz create mode 100644 pytest-benchmark-5.1.0.tar.gz diff --git a/fix-test-fast.patch b/fix-test-fast.patch deleted file mode 100644 index 5baad25..0000000 --- a/fix-test-fast.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/tests/test_normal.py -+++ b/tests/test_normal.py -@@ -5,6 +5,7 @@ Just to make sure the plugin doesn't cho - Yay, doctests! - - """ -+import platform - import sys # noqa - import time - from functools import partial -@@ -20,7 +21,10 @@ def test_fast(benchmark): - assert result is None - - if not benchmark.disabled: -- assert benchmark.stats.stats.min >= 0.000001 -+ if '32' in platform.architecture()[0]: -+ assert benchmark.stats.stats.min >= 0.0000001 -+ else: -+ assert benchmark.stats.stats.min >= 0.000001 - - - def test_slow(benchmark): diff --git a/py311.patch b/py311.patch deleted file mode 100644 index b775b58..0000000 --- a/py311.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --git a/src/pytest_benchmark/compat.py b/src/pytest_benchmark/compat.py -index 63d01bd..9afecf2 100644 ---- a/src/pytest_benchmark/compat.py -+++ b/src/pytest_benchmark/compat.py -@@ -1,3 +1,4 @@ - import sys - - PY38 = sys.version_info[0] == 3 and sys.version_info[1] >= 8 -+PY311 = sys.version_info[0] == 3 and sys.version_info[1] >= 11 -diff --git a/src/pytest_benchmark/utils.py b/src/pytest_benchmark/utils.py -index c80352a..e28c04e 100644 ---- a/src/pytest_benchmark/utils.py -+++ b/src/pytest_benchmark/utils.py -@@ -26,7 +26,7 @@ - - import genericpath - --from .compat import PY38 -+from .compat import PY38, PY311 - - # This is here (in the utils module) because it might be used by - # various other modules. -@@ -521,6 +521,10 @@ def clonefunc(f): - co.co_firstlineno, co.co_lnotab, co.co_freevars, co.co_cellvars] - if PY38: - args.insert(1, co.co_posonlyargcount) -+ -+ if PY311: -+ args.insert(12, co.co_qualname) -+ args.insert(15, co.co_exceptiontable) - co2 = types.CodeType(*args) - # - # then, we clone the function itself, using the new co2 -diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py -index 280ce24..964787f 100644 ---- a/tests/test_benchmark.py -+++ b/tests/test_benchmark.py -@@ -952,7 +952,6 @@ def result(): - - " def test_bad(benchmark):", - "? @benchmark", -- "? def result():", - - "test_abort_broken.py:*", - "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*", diff --git a/pytest-benchmark-4.0.0.tar.gz b/pytest-benchmark-4.0.0.tar.gz deleted file mode 100644 index 4081a04..0000000 --- a/pytest-benchmark-4.0.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fb0785b83efe599a6a956361c0691ae1dbb5318018561af10f3e915caa0048d1 -size 334641 diff --git a/pytest-benchmark-5.1.0.tar.gz b/pytest-benchmark-5.1.0.tar.gz new file mode 100644 index 0000000..8c966b9 --- /dev/null +++ b/pytest-benchmark-5.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ea661cdc292e8231f7cd4c10b0319e56a2118e2c09d9f50e1b3d150d2aca105 +size 337810 diff --git a/python-pytest-benchmark.changes b/python-pytest-benchmark.changes index 5be7231..4abf3ed 100644 --- a/python-pytest-benchmark.changes +++ b/python-pytest-benchmark.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Mon Nov 25 12:42:56 UTC 2024 - Dirk Müller + +- update to 5.1.0: + * Fixed broken hooks handling on pytest 8.1 or later (the + TypeError: import_path() missing 1 required keyword-only + argument: 'consider_namespace_packages' issue). Unfortunately + this sets the minimum supported pytest version to 8.1. + * Fixed bad fixture check that broke down then nbmake was + enabled. + * Dropped support for now EOL Python 3.8. Also moved tests + suite to only test the latest pytest versions (8.3.x). + * Fix generate parametrize tests benchmark csv report errors + (issue #268). Contributed by Johnny Huang in #269. + * Added the --benchmark-time-unit cli option for overriding the + measurement unit used for display. Contributed by Tony Kuo in + #257. + * Fixes spelling in some help texts. Contributed by Eugeniy in + #267. + * Added new cprofile options: --benchmark-cprofile-loops=LOOPS + - previously profiling only ran the function once, this allow + customization. --benchmark-cprofile-top=COUNT - allows + showing more rows. --benchmark-cprofile-dump=[FILENAME- + PREFIX] - allows saving to a file (that you can load in + snakeviz, RunSnakeRun or other tools). + * --benchmark-cprofile-loops=LOOPS - previously profiling only + ran the function once, this allow customization. + * --benchmark-cprofile-top=COUNT - allows showing more rows. + * --benchmark-cprofile-dump=[FILENAME-PREFIX] - allows saving + to a file (that you can load in snakeviz, RunSnakeRun or + other tools). + * Removed hidden dependency on py.path (replaced with pathlib). +- drop fix-test-fast.patch, py311.patch, fix-test-fast.patch: upstream + ------------------------------------------------------------------- Mon Mar 4 22:09:46 UTC 2024 - Matej Cepl diff --git a/python-pytest-benchmark.spec b/python-pytest-benchmark.spec index 946d864..c76a2b9 100644 --- a/python-pytest-benchmark.spec +++ b/python-pytest-benchmark.spec @@ -16,18 +16,14 @@ # -%define skip_python2 1 %{?sle15_python_module_pythons} Name: python-pytest-benchmark -Version: 4.0.0 +Version: 5.1.0 Release: 0 Summary: A py.test fixture for benchmarking code License: BSD-2-Clause URL: https://github.com/ionelmc/pytest-benchmark Source: https://files.pythonhosted.org/packages/source/p/pytest-benchmark/pytest-benchmark-%{version}.tar.gz -Patch0: fix-test-fast.patch -# PATCH-FIX-OPENSUSE py311.patch gh#ionelmc/pytest-benchmark#232 -Patch1: py311.patch # PATCH-FIX-OPENSUSE Ignore DeprecationWarning, some of our dependancies use # pkg_resources. Patch2: ignore-deprecationwarning.patch @@ -61,6 +57,8 @@ rounds that are calibrated to the chosen timer. %prep %autosetup -p1 -n pytest-benchmark-%{version} +# skip nbmake +rm pytest.ini # skip cli tests as we use update-alternatives rm -f tests/test_cli.py # Don't look for a test pass in the wrong place -- https://github.com/ionelmc/pytest-benchmark/issues/214 -- 2.51.1 From 3b798d0a29d0bfedd716eeaf516bf8dede05565a8c37b85a516052e0dd42cc99 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Tue, 26 Aug 2025 08:47:40 +0000 Subject: [PATCH 2/3] - Convert to libalternatives on SLE-16-based and newer systems OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-benchmark?expand=0&rev=34 --- python-pytest-benchmark.changes | 5 +++++ python-pytest-benchmark.spec | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/python-pytest-benchmark.changes b/python-pytest-benchmark.changes index 4abf3ed..17efb01 100644 --- a/python-pytest-benchmark.changes +++ b/python-pytest-benchmark.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 21 15:41:07 UTC 2025 - Markéta Machová + +- Convert to libalternatives on SLE-16-based and newer systems + ------------------------------------------------------------------- Mon Nov 25 12:42:56 UTC 2024 - Dirk Müller diff --git a/python-pytest-benchmark.spec b/python-pytest-benchmark.spec index c76a2b9..fbe219b 100644 --- a/python-pytest-benchmark.spec +++ b/python-pytest-benchmark.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-benchmark # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,11 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif %{?sle15_python_module_pythons} Name: python-pytest-benchmark Version: 5.1.0 @@ -42,13 +47,18 @@ BuildRequires: git-core BuildRequires: python-rpm-macros Requires: python-py-cpuinfo Requires: python-pytest >= 3.8 -Requires(post): update-alternatives -Requires(postun): update-alternatives Recommends: python-aspectlib Recommends: python-elasticsearch Recommends: python-pygal Recommends: python-pygaljs BuildArch: noarch +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif %python_subpackages %description @@ -77,6 +87,9 @@ sed -i -e '/test_fast PASSED/d' -e '/test_fast SKIPPED/d' tests/test_benchmark.p %check %pytest tests +%pre +%python_libalternatives_reset_alternative pytest-benchmark + %post %{python_install_alternative pytest-benchmark py.test-benchmark} -- 2.51.1 From d96a16df80402551836307fb5e45668b259e587f176c3ebe6b6d2178c461fa98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Wed, 5 Nov 2025 13:40:21 +0100 Subject: [PATCH 3/3] update to 5.2.1 --- pytest-benchmark-5.1.0.tar.gz | 3 --- pytest_benchmark-5.2.1.tar.gz | 3 +++ python-pytest-benchmark.changes | 12 ++++++++++++ python-pytest-benchmark.spec | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) delete mode 100644 pytest-benchmark-5.1.0.tar.gz create mode 100644 pytest_benchmark-5.2.1.tar.gz diff --git a/pytest-benchmark-5.1.0.tar.gz b/pytest-benchmark-5.1.0.tar.gz deleted file mode 100644 index 8c966b9..0000000 --- a/pytest-benchmark-5.1.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9ea661cdc292e8231f7cd4c10b0319e56a2118e2c09d9f50e1b3d150d2aca105 -size 337810 diff --git a/pytest_benchmark-5.2.1.tar.gz b/pytest_benchmark-5.2.1.tar.gz new file mode 100644 index 0000000..2258027 --- /dev/null +++ b/pytest_benchmark-5.2.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56dc1455bda7ccb540aa671c496dafc8187d2769f278e5f137689476805b6f9d +size 339278 diff --git a/python-pytest-benchmark.changes b/python-pytest-benchmark.changes index 17efb01..2f1d243 100644 --- a/python-pytest-benchmark.changes +++ b/python-pytest-benchmark.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Wed Nov 5 12:35:00 UTC 2025 - Markéta Machová + +- Update to 5.2.1 + * Added support for a per-round teardown function to pedantic mode. + * Added --benchmark-time-unit option. + * Fixed deprecated hook examples in docstrings. + * Changed --benchmark-compare-fail to accept percentages higher than 100%. + * Replaced the complicated and broken code of pytest_benchmark.utils.clonefunc + with a simple return of the input. + * Add markers so pytest doesn’t try to assert-rewrite the plugin internals + ------------------------------------------------------------------- Thu Aug 21 15:41:07 UTC 2025 - Markéta Machová diff --git a/python-pytest-benchmark.spec b/python-pytest-benchmark.spec index fbe219b..5048471 100644 --- a/python-pytest-benchmark.spec +++ b/python-pytest-benchmark.spec @@ -23,12 +23,12 @@ %endif %{?sle15_python_module_pythons} Name: python-pytest-benchmark -Version: 5.1.0 +Version: 5.2.1 Release: 0 Summary: A py.test fixture for benchmarking code License: BSD-2-Clause URL: https://github.com/ionelmc/pytest-benchmark -Source: https://files.pythonhosted.org/packages/source/p/pytest-benchmark/pytest-benchmark-%{version}.tar.gz +Source: https://files.pythonhosted.org/packages/source/p/pytest_benchmark/pytest_benchmark-%{version}.tar.gz # PATCH-FIX-OPENSUSE Ignore DeprecationWarning, some of our dependancies use # pkg_resources. Patch2: ignore-deprecationwarning.patch @@ -66,7 +66,7 @@ A py.test fixture for benchmarking code. It will group the tests into rounds that are calibrated to the chosen timer. %prep -%autosetup -p1 -n pytest-benchmark-%{version} +%autosetup -p1 -n pytest_benchmark-%{version} # skip nbmake rm pytest.ini # skip cli tests as we use update-alternatives -- 2.51.1