Compare commits
2 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 3a67e1e076 | |||
| f1838af0fc |
@@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 21 03:05:21 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch support-new-pytest-asyncio.patch:
|
||||||
|
* Support changes required for pytest-asyncio 1.0.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Mar 21 07:43:10 UTC 2024 - Max Lin <mlin@suse.com>
|
Thu Mar 21 07:43:10 UTC 2024 - Max Lin <mlin@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-backoff
|
# spec file for package python-backoff
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -15,15 +15,17 @@
|
|||||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-backoff
|
Name: python-backoff
|
||||||
Version: 2.2.1
|
Version: 2.2.1
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Function decoration for backoff and retry
|
Summary: Function decoration for backoff and retry
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
|
||||||
URL: https://github.com/litl/backoff
|
URL: https://github.com/litl/backoff
|
||||||
Source0: https://files.pythonhosted.org/packages/source/b/backoff/backoff-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/b/backoff/backoff-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM gh#litl/backoff#224
|
||||||
|
Patch0: support-new-pytest-asyncio.patch
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module poetry-core >= 1}
|
BuildRequires: %{python_module poetry-core >= 1}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@@ -50,7 +52,7 @@ Decorators support both regular functions for synchronous code and
|
|||||||
for asynchronous code.
|
for asynchronous code.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n backoff-%{version}
|
%autosetup -p1 -n backoff-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
|
|||||||
93
support-new-pytest-asyncio.patch
Normal file
93
support-new-pytest-asyncio.patch
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
From 0fc3d0342143e1579075a8873bbcba94d14a3fd3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takuya Wakazono <pastalian46@gmail.com>
|
||||||
|
Date: Thu, 26 Jun 2025 00:40:53 +0900
|
||||||
|
Subject: [PATCH] Adapt test cases to pytest-asyncio 1.0 compatibility
|
||||||
|
|
||||||
|
- Remove deprecated event_loop fixture
|
||||||
|
https://pytest-asyncio.readthedocs.io/en/stable/reference/changelog.html#removed
|
||||||
|
- Drop *_without_event_loop tests
|
||||||
|
These incompatible tests (*1) are no longer needed since the
|
||||||
|
underlying code has already been removed (introduced in a460156,
|
||||||
|
removed in 5d714ccd).
|
||||||
|
|
||||||
|
*1: asyncio.get_event_loop() now raises a RuntimeError in Python 3.14
|
||||||
|
when no loop exists.
|
||||||
|
https://docs.python.org/3.14/whatsnew/3.14.html#id7
|
||||||
|
---
|
||||||
|
tests/test_backoff_async.py | 53 ++-----------------------------------
|
||||||
|
1 file changed, 2 insertions(+), 51 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_backoff_async.py b/tests/test_backoff_async.py
|
||||||
|
index 226ef08..dbdb0fb 100644
|
||||||
|
--- a/tests/test_backoff_async.py
|
||||||
|
+++ b/tests/test_backoff_async.py
|
||||||
|
@@ -665,7 +665,7 @@ async def exceptor():
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
-async def test_on_exception_coro_cancelling(event_loop):
|
||||||
|
+async def test_on_exception_coro_cancelling():
|
||||||
|
sleep_started_event = asyncio.Event()
|
||||||
|
|
||||||
|
@backoff.on_predicate(backoff.expo)
|
||||||
|
@@ -679,59 +679,10 @@ async def coro():
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
- task = event_loop.create_task(coro())
|
||||||
|
+ task = asyncio.create_task(coro())
|
||||||
|
|
||||||
|
await sleep_started_event.wait()
|
||||||
|
|
||||||
|
task.cancel()
|
||||||
|
|
||||||
|
assert (await task)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-def test_on_predicate_on_regular_function_without_event_loop(monkeypatch):
|
||||||
|
- monkeypatch.setattr('time.sleep', lambda x: None)
|
||||||
|
-
|
||||||
|
- # Set default event loop to None.
|
||||||
|
- loop = asyncio.get_event_loop()
|
||||||
|
- asyncio.set_event_loop(None)
|
||||||
|
-
|
||||||
|
- try:
|
||||||
|
- @backoff.on_predicate(backoff.expo)
|
||||||
|
- def return_true(log, n):
|
||||||
|
- val = (len(log) == n - 1)
|
||||||
|
- log.append(val)
|
||||||
|
- return val
|
||||||
|
-
|
||||||
|
- log = []
|
||||||
|
- ret = return_true(log, 3)
|
||||||
|
- assert ret is True
|
||||||
|
- assert 3 == len(log)
|
||||||
|
-
|
||||||
|
- finally:
|
||||||
|
- # Restore event loop.
|
||||||
|
- asyncio.set_event_loop(loop)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-def test_on_exception_on_regular_function_without_event_loop(monkeypatch):
|
||||||
|
- monkeypatch.setattr('time.sleep', lambda x: None)
|
||||||
|
-
|
||||||
|
- # Set default event loop to None.
|
||||||
|
- loop = asyncio.get_event_loop()
|
||||||
|
- asyncio.set_event_loop(None)
|
||||||
|
-
|
||||||
|
- try:
|
||||||
|
- @backoff.on_exception(backoff.expo, KeyError)
|
||||||
|
- def keyerror_then_true(log, n):
|
||||||
|
- if len(log) == n:
|
||||||
|
- return True
|
||||||
|
- e = KeyError()
|
||||||
|
- log.append(e)
|
||||||
|
- raise e
|
||||||
|
-
|
||||||
|
- log = []
|
||||||
|
- assert keyerror_then_true(log, 3) is True
|
||||||
|
- assert 3 == len(log)
|
||||||
|
-
|
||||||
|
- finally:
|
||||||
|
- # Restore event loop.
|
||||||
|
- asyncio.set_event_loop(loop)
|
||||||
Reference in New Issue
Block a user