Sync from SUSE:SLFO:Main python-pytest-run-parallel revision e502820fb0112e08b6804ca686a5bb34

This commit is contained in:
2025-06-30 17:50:53 +02:00
commit 843c5bab31
5 changed files with 236 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

133
i586.patch Normal file
View File

@@ -0,0 +1,133 @@
From 1d51e5706a9983c99761c7a65e6d79cfb9bf7462 Mon Sep 17 00:00:00 2001
From: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Date: Thu, 24 Apr 2025 08:42:02 -0600
Subject: [PATCH 1/2] attempt to fix 32 bit architectures
---
src/pytest_run_parallel/plugin.py | 79 ++++++++++++++++---------------
1 file changed, 41 insertions(+), 38 deletions(-)
diff --git a/src/pytest_run_parallel/plugin.py b/src/pytest_run_parallel/plugin.py
index 42d3d03..dc419b1 100644
--- a/src/pytest_run_parallel/plugin.py
+++ b/src/pytest_run_parallel/plugin.py
@@ -65,52 +65,55 @@ def pytest_configure(config):
def wrap_function_parallel(fn, n_workers, n_iterations):
- barrier = threading.Barrier(n_workers)
- original_switch = sys.getswitchinterval()
- sys.setswitchinterval(0.000001)
-
@functools.wraps(fn)
def inner(*args, **kwargs):
errors = []
skip = None
failed = None
-
- def closure(*args, **kwargs):
- for _ in range(n_iterations):
- barrier.wait()
- try:
- fn(*args, **kwargs)
- except Warning:
- pass
- except Exception as e:
- errors.append(e)
- except _pytest.outcomes.Skipped as s:
- nonlocal skip
- skip = s.msg
- except _pytest.outcomes.Failed as f:
- nonlocal failed
- failed = f
-
- workers = []
- for _ in range(0, n_workers):
- worker_kwargs = kwargs
- workers.append(
- threading.Thread(target=closure, args=args, kwargs=worker_kwargs)
- )
-
- num_completed = 0
+ barrier = threading.Barrier(n_workers)
+ original_switch = sys.getswitchinterval()
try:
- for worker in workers:
- worker.start()
- num_completed += 1
- finally:
- if num_completed < len(workers):
- barrier.abort()
+ sys.setswitchinterval(0.000001)
+
+ def closure(*args, **kwargs):
+ for _ in range(n_iterations):
+ barrier.wait()
+ try:
+ fn(*args, **kwargs)
+ except Warning:
+ pass
+ except Exception as e:
+ errors.append(e)
+ except _pytest.outcomes.Skipped as s:
+ nonlocal skip
+ skip = s.msg
+ except _pytest.outcomes.Failed as f:
+ nonlocal failed
+ failed = f
+
+ workers = []
+ for _ in range(0, n_workers):
+ worker_kwargs = kwargs
+ workers.append(
+ threading.Thread(
+ target=closure, args=args, kwargs=worker_kwargs
+ )
+ )
+
+ num_completed = 0
+ try:
+ for worker in workers:
+ worker.start()
+ num_completed += 1
+ finally:
+ if num_completed < len(workers):
+ barrier.abort()
- for worker in workers:
- worker.join()
+ for worker in workers:
+ worker.join()
- sys.setswitchinterval(original_switch)
+ finally:
+ sys.setswitchinterval(original_switch)
if skip is not None:
pytest.skip(skip)
From feed20573c21c15178793186beffe984b60ec17f Mon Sep 17 00:00:00 2001
From: "pre-commit-ci-lite[bot]"
<117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Date: Thu, 24 Apr 2025 14:47:11 +0000
Subject: [PATCH 2/2] [pre-commit.ci lite] apply automatic fixes
---
src/pytest_run_parallel/plugin.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/pytest_run_parallel/plugin.py b/src/pytest_run_parallel/plugin.py
index dc419b1..5548cba 100644
--- a/src/pytest_run_parallel/plugin.py
+++ b/src/pytest_run_parallel/plugin.py
@@ -95,9 +95,7 @@ def closure(*args, **kwargs):
for _ in range(0, n_workers):
worker_kwargs = kwargs
workers.append(
- threading.Thread(
- target=closure, args=args, kwargs=worker_kwargs
- )
+ threading.Thread(target=closure, args=args, kwargs=worker_kwargs)
)
num_completed = 0

BIN
pytest_run_parallel-0.4.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,14 @@
-------------------------------------------------------------------
Thu Apr 24 11:10:29 UTC 2025 - Markéta Machová <mmachova@suse.com>
- update to 0.4.2
* Upgrade gh-action-pypi-publish to fix metadata error
* Remove deprecated argument in pytest_report_collectionfinish
* Report manually marked single-threaded tests
* Detect unsafe calls that occur under assigments
- Add i586.patch to fix behaviour on 32 bit
-------------------------------------------------------------------
Tue Apr 22 12:12:29 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Initial packaging (v0.4.0), needed by pydantic

View File

@@ -0,0 +1,63 @@
#
# spec file for package python-pytest-run-parallel
#
# 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
# 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/
#
Name: python-pytest-run-parallel
Version: 0.4.2
Release: 0
Summary: A simple pytest plugin to run tests concurrently
License: MIT
URL: https://github.com/Quansight-Labs/pytest-run-parallel
Source: https://files.pythonhosted.org/packages/source/p/pytest-run-parallel/pytest_run_parallel-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/Quansight-Labs/pytest-run-parallel/pull/54 attempt to fix 32 bit architectures
Patch: i586.patch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 61.0.0}
# SECTION test requirements
BuildRequires: %{python_module pytest >= 6.2.0}
BuildRequires: %{python_module pytest-order}
BuildRequires: %{python_module hypothesis}
# /SECTION
BuildRequires: fdupes
Requires: python-pytest >= 6.2.0
Suggests: python-psutil >= 6.1.1
BuildArch: noarch
%python_subpackages
%description
A simple pytest plugin to run tests concurrently
%prep
%autosetup -p1 -n pytest_run_parallel-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%license LICENSE
%{python_sitelib}/pytest_run_parallel
%{python_sitelib}/pytest_run_parallel-%{version}.dist-info
%changelog