- Update to 0.8.1 #1

Merged
StevenK merged 1 commits from update-to-0.8.1 into main 2026-01-05 04:55:32 +01:00
5 changed files with 49 additions and 141 deletions

View File

@@ -1,133 +0,0 @@
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

Binary file not shown.

BIN
pytest_run_parallel-0.8.1.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,3 +1,44 @@
-------------------------------------------------------------------
Mon Jan 5 03:32:42 UTC 2026 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 0.8.1:
* Only run logic for selected pytest items
* fix: add capteesys, capsysbinary, capfd and capfdbinary to thread-unsafe
fixtures
* Update license infomation format in pyproject.toml
* Fix typos discovered by codespell
* Add a parallel_threads_limit mark
* Detect gc.collect and mark tests as thread unsafe
* Fix --forever interaction with pytest-xdist
* Create thread_id and iteration_id fixtures
* Patch tmp_path/tmpdir to be thread-safe
* globals and AST parsing exception handling
* Add option --forever to keep running tests in a never-ending loop
* Fix thread-unsafe detection for indented tests
* Run coverage externally to load before plugins
* Support Python 3.14
* Change hypothesis check to be version based
* Handle functions with __module__ is None
* Refactor plugin into multiple files
* Support chained attributes in thread unsafe detection
* Improvements to thread safety detection and implement disallowing whole
modules
* Skip analyzing doctests and add num_parallel_threads fixture everywhere
* adjust terminal summary when skip-thread-unsafe is set
* Strip leading whitespace instead of dedent for test source code
* Avoid AttributeError in terminalsummary
* Rewrite pytest hooks as a class plugin
* Remove cliff since we don't use it
* Fix failures report when test is marked as thread-unsafe
* Add an option to skip thread-unsafe tests
* detect unitest.mock use and skip parallel tests for tests that use it
* attempt to fix 32 bit architectures
* Add monkeypatch to thread-unsafe fixtures
* use an lru_cache to speed up recursive ast parsing
* Set switch interval in a loop with increasing numbers
* Fix tests on Linux when psutil is installed
- Drop patch i586.patch, merged upstream.
-------------------------------------------------------------------
Thu Apr 24 11:10:29 UTC 2025 - Markéta Machová <mmachova@suse.com>

View File

@@ -17,24 +17,23 @@
Name: python-pytest-run-parallel
Version: 0.4.2
Version: 0.8.1
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 >= 8.4.0}
BuildRequires: %{python_module pytest-order}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module hypothesis}
# /SECTION
BuildRequires: fdupes
Requires: python-pytest >= 6.2.0
Requires: python-pytest >= 8.4.0
Suggests: python-psutil >= 6.1.1
BuildArch: noarch
%python_subpackages
@@ -57,6 +56,7 @@ A simple pytest plugin to run tests concurrently
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/pytest_run_parallel
%{python_sitelib}/pytest_run_parallel-%{version}.dist-info