Compare commits

..

No commits in common. "factory" and "factory" have entirely different histories.

6 changed files with 75 additions and 40 deletions

22
fix-test-fast.patch Normal file
View File

@ -0,0 +1,22 @@
--- 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):

45
py311.patch Normal file
View File

@ -0,0 +1,45 @@
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:*",
"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*",

BIN
pytest-benchmark-4.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ea661cdc292e8231f7cd4c10b0319e56a2118e2c09d9f50e1b3d150d2aca105
size 337810

View File

@ -1,37 +1,3 @@
-------------------------------------------------------------------
Mon Nov 25 12:42:56 UTC 2024 - Dirk Müller <dmueller@suse.com>
- 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 <mcepl@cepl.eu>

View File

@ -16,14 +16,18 @@
#
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-pytest-benchmark
Version: 5.1.0
Version: 4.0.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
@ -57,8 +61,6 @@ 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