commit b13c7b05d8410f70edb18822a1e54e8ee2d3628dd0637b9ca3b07980d7137832 Author: Steve Kowalik Date: Mon Jul 21 03:06:21 2025 +0000 - Add patch support-new-pytest-asyncio.patch: * Support changes required for pytest-asyncio 1.0. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-backoff?expand=0&rev=15 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/backoff-2.2.1.tar.gz b/backoff-2.2.1.tar.gz new file mode 100644 index 0000000..8f6c221 --- /dev/null +++ b/backoff-2.2.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b92e74aac38ec49e97ac899c96c882496c7b09cf4235e8da205e62b2c6c001d +size 20194 diff --git a/python-backoff.changes b/python-backoff.changes new file mode 100644 index 0000000..41d39de --- /dev/null +++ b/python-backoff.changes @@ -0,0 +1,75 @@ +------------------------------------------------------------------- +Mon Jul 21 03:05:21 UTC 2025 - Steve Kowalik + +- 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 + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Mon May 8 20:47:29 UTC 2023 - Ben Greiner + +- Clean build and test dependencies + * No coverage check needed, no pytest-cov + * Poetry-core is enough to build, less footprint + +------------------------------------------------------------------- +Thu Oct 13 06:36:05 UTC 2022 - Adrian Schröter + +- update to version 2.2.1 + - Fix type hint for wait generators https://github.com/litl/backoff/issues/177 + - Improve type annotation for wait generators from @hauntsaninja + - Include exception in details dict of call handlers from @petamas + - Improve type hints for call handlers from @cdce8p + - Don't use importlib.metadata for __version__ https://github.com/litl/backoff/issues/166 + - Fix bug with max_tries/max_time callables https://github.com/litl/backoff/issues/164 + - Get max_tries/max_time values for every call fixes #160 (from @jvrsantacruz) + - Allow None for jitter keyword arg (typing) + - Add raise_on_giveup keyword arg for decorators + - Add backoff.runtime wait generator for dynamically setting wait times based + on target function return value or exception details + - Improve type hints for on_success, on_backoff, on_giveup handlers + - Use decorator-specific detail and handler type hints + - Optionally use typing_extensions for python 3.7 type hinting + - Drop python 3.6 support + - Add python 3.10 support + +------------------------------------------------------------------- +Fri Jan 17 16:42:58 UTC 2020 - Marketa Calabkova + +- update to 1.10.0 + * Support python 3.8 + * Allow sync decorator call from async function + +------------------------------------------------------------------- +Tue Jun 4 06:33:28 UTC 2019 - pgajdos@suse.com + +- version update to 1.8.0 + - Change default log level from ERROR to INFO + - Log retries on exception as INFO + - Support Python 3.7 + - Give up on StopIteration raised in wait generators + - Iterable intervals for constant wait_gen for predefined wait sequences + - Nullary jitter signature deprecation warning + - Custom loggers + +------------------------------------------------------------------- +Tue Dec 4 12:45:56 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Wed May 9 18:26:24 UTC 2018 - toddrme2178@gmail.com + +- Update to 1.5.0 + * Add max_time keyword argument +- Use license tag + +------------------------------------------------------------------- +Tue Sep 26 18:26:02 UTC 2017 - t.gruner@katodev.de + +- Initial release version 1.4.3 + diff --git a/python-backoff.spec b/python-backoff.spec new file mode 100644 index 0000000..5e4330a --- /dev/null +++ b/python-backoff.spec @@ -0,0 +1,73 @@ +# +# spec file for package python-backoff +# +# 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/ +# + + +%{?sle15_python_module_pythons} +Name: python-backoff +Version: 2.2.1 +Release: 0 +Summary: Function decoration for backoff and retry +License: MIT +URL: https://github.com/litl/backoff +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 poetry-core >= 1} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module requests} +BuildRequires: %{python_module responses} +# /SECTION +%python_subpackages + +%description +This module provides function decorators which can be used to wrap a +function such that it will be retried until some condition is met. It +is meant to be of use when accessing unreliable resources with the +potential for intermittent failures i.e. network resources and external +APIs. Somewhat more generally, it may also be of use for dynamically +polling resources for externally generated content. + +Decorators support both regular functions for synchronous code and +`asyncio `_'s coroutines +for asynchronous code. + +%prep +%autosetup -p1 -n backoff-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/backoff +%{python_sitelib}/backoff-%{version}.dist-info + +%changelog diff --git a/support-new-pytest-asyncio.patch b/support-new-pytest-asyncio.patch new file mode 100644 index 0000000..709cf20 --- /dev/null +++ b/support-new-pytest-asyncio.patch @@ -0,0 +1,93 @@ +From 0fc3d0342143e1579075a8873bbcba94d14a3fd3 Mon Sep 17 00:00:00 2001 +From: Takuya Wakazono +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)