Sync from SUSE:SLFO:Main python-pytest-benchmark revision 43d3478292633e6b616ba158b44f7f48

This commit is contained in:
Adrian Schröter 2024-05-03 22:18:48 +02:00
commit 3a42b00858
7 changed files with 349 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

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):

View File

@ -0,0 +1,12 @@
Index: pytest-benchmark-4.0.0/pytest.ini
===================================================================
--- pytest-benchmark-4.0.0.orig/pytest.ini
+++ pytest-benchmark-4.0.0/pytest.ini
@@ -32,6 +32,7 @@ testpaths =
# Idea from: https://til.simonwillison.net/pytest/treat-warnings-as-errors
filterwarnings =
error
+ ignore::DeprecationWarning
# You can add exclusions, some examples:
# ignore:'pytest_benchmark' defines default_app_config:PendingDeprecationWarning::
# ignore:The {{% if:::

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

@ -0,0 +1,150 @@
-------------------------------------------------------------------
Fri Apr 21 12:31:29 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:43:59 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Mon Mar 20 05:13:36 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add ptch ignore-deprecationwarning.patch:
* Ignore DeprecationWarning, some of our dependancies use pkg_resources.
-------------------------------------------------------------------
Tue Jan 17 13:03:29 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Modify the py311.patch to fix the test_abort_broken test, instead of
disabling.
-------------------------------------------------------------------
Tue Jan 17 12:44:25 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Add py311.patch to make it compatible with python 3.11,
gh#ionelmc/pytest-benchmark#232
- Disable broken test_abort_broken, this test is broken because the output of
the tests is a bit different with python 3.11 so we can disable until it's
fixed.
-------------------------------------------------------------------
Wed Nov 30 07:44:51 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Update to 4.0.0:
* Dropped support for legacy Pythons (2.7, 3.6 or older).
* Switched CI to GitHub Actions.
* Removed dependency on the py library (that was not properly specified as a
dependency anyway).
* Fix skipping test in test_utils.py if appropriate VCS not available. Also
fix typo. Contributed by Sam James in #211.
* Added support for pytest 7.2.0 by using pytest.hookimpl and pytest.hookspec
to configure hooks. Contributed by Florian Bruhin in #224.
* Now no save is attempted if --benchmark-disable is used. Fixes #205.
Contributed by Friedrich Delgado in #207.
-------------------------------------------------------------------
Mon Mar 28 21:07:02 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 3.4.1
* Disable progress indication unless --benchmark-verbose is used.
Contributed by Dimitris Rozakis in #149.
* Added Python 3.9, dropped Python 3.5. Contributed by Miroslav
Šedivý in #189.
* Changed the "cpu" data in the json output to include everything
that cpuinfo outputs, for better or worse as cpuinfo 6.0
changed some fields. Users should now ensure they are an
adequate cpuinfo package installed. MAY BE BACKWARDS
INCOMPATIBLE
* Changed behavior of --benchmark-skip and --benchmark-only to
apply early in the collection phase. This means skipped tests
won't make pytest run fixtures for said tests unnecessarily,
but unfortunately this also means the skipping behavior will be
applied to any tests that requires a "benchmark" fixture,
regardless if it would come from pytest-benchmark or not. MAY
BE BACKWARDS INCOMPATIBLE
* Added --benchmark-quiet - option to disable reporting and other
information output.
* Squelched unnecessary warning when --benchmark-disable and save
options are used. Fixes #199.
* PerformanceRegression exception no longer inherits
pytest.UsageError (apparently a final class).
-------------------------------------------------------------------
Wed Aug 5 21:31:21 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Remove pytest-xdist from build
- Re-activate test suite
-------------------------------------------------------------------
Fri Mar 13 12:42:10 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix buidling without python2
-------------------------------------------------------------------
Mon Jan 13 14:13:23 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 3.2.3:
* Fixed "already-imported" pytest warning. Contributed by Jonathan Simon Prates in #151.
* Fixed breakage that occurs when benchmark is disabled while using cprofile feature (by disabling cprofile too).
* Dropped Python 3.4 from the test suite and updated test deps.
* Fixed pytest_benchmark.utils.clonefunc to work on Python 3.8.
-------------------------------------------------------------------
Mon Jul 22 08:30:20 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Disable tests for now, the output from pytest changed quite a
bit and upstream needs to adapt it for pytest5. The plugin
actually works, it just fails its own testsuite...
-------------------------------------------------------------------
Thu May 9 14:49:19 CEST 2019 - Matej Cepl <mcepl@suse.com>
- Add fix-test-fast.patch to avoid failing
tests/test_normal.py::test_fast test on 32bit platform.
-------------------------------------------------------------------
Thu Mar 28 13:13:55 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Try to avoid messing up bytecode of the installed pkg
-------------------------------------------------------------------
Tue Mar 26 10:16:44 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add missing dependency on pygal and pygaljs
-------------------------------------------------------------------
Mon Mar 25 11:00:57 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add missing dependency on aspectlib
-------------------------------------------------------------------
Wed Feb 13 14:43:30 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 3.2.2:
* Added support for pytest items without funcargs. Fixes interoperability with other pytest plugins like pytest-flake8.
* Added missing version constraint change. Now pytest >= 3.8 is required (due to pytest 4.1 support).
* Fixed couple CI/test issues.
* Fixed broken pytest_benchmark.__version__.
* Added support for simple trial x-axis histogram label. Contributed by Ken Crowell in #95).
* Added support for Pytest 3.3+, Contributed by Julien Nicoulaud in #103.
* Added support for Pytest 4.0. Contributed by Pablo Aguiar in #129 and #130.
* Added support for Pytest 4.1.
* Various formatting, spelling and documentation fixes. Contributed by Ken Crowell, Ofek Lev, Matthew Feickert, Jose Eduardo, Anton Lodder, Alexander Duryagin and Grygorii Iermolenko in #97, #97, #105, #110, #111, #115, #123, #131 and #140.
* Fixed broken pytest_benchmark_update_machine_info hook. Contributed by Alex Ford in #109.
* Fixed bogus xdist warning when using --benchmark-disable. Contributed by Francesco Ballarin in #113.
* Added support for pathlib2. Contributed by Lincoln de Sousa in #114.
* Changed handling so you can use --benchmark-skip and --benchmark-only, with the later having priority. Contributed by Ofek Lev in #116.
* Fixed various CI/testing issues. Contributed by Stanislav Levin in #134, #136 and #138.
-------------------------------------------------------------------
Wed May 9 23:25:39 UTC 2018 - toddrme2178@gmail.com
- Use license tag
- Implement update-alternatives
-------------------------------------------------------------------
Thu Oct 19 00:24:23 UTC 2017 - toddrme2178@gmail.com
- Initial version

View File

@ -0,0 +1,94 @@
#
# spec file for package python-pytest-benchmark
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-pytest-benchmark
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
BuildRequires: %{python_module aspectlib}
BuildRequires: %{python_module elasticsearch}
BuildRequires: %{python_module freezegun}
BuildRequires: %{python_module py-cpuinfo}
BuildRequires: %{python_module pygaljs}
BuildRequires: %{python_module pygal}
BuildRequires: %{python_module pytest >= 3.8}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
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
%python_subpackages
%description
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}
# 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
sed -i -e '/test_fast PASSED/d' -e '/test_fast SKIPPED/d' tests/test_benchmark.py
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/pytest-benchmark
%python_clone -a %{buildroot}%{_bindir}/py.test-benchmark
%check
%pytest tests
%post
%{python_install_alternative pytest-benchmark py.test-benchmark}
%postun
%python_uninstall_alternative pytest-benchmark
%files %{python_files}
%doc AUTHORS.rst CHANGELOG.rst README.rst
%license LICENSE
%python_alternative %{_bindir}/py.test-benchmark
%python_alternative %{_bindir}/pytest-benchmark
%{python_sitelib}/pytest_benchmark
%{python_sitelib}/pytest_benchmark-%{version}*-info
%changelog