14
0
forked from pool/python-pook
Files
python-pook/py311-compat.patch
Daniel Garcia 1c268d0299 - Add py311-compat.patch to fix python-3.11 compatibility
- Update to 1.1.0:
  * chore(version): bump minor v1.1.0
  * Switch to Python >= 3.5 and fix latest aiohttp compatability (#83)
  * fix: remove print call (#81)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pook?expand=0&rev=12
2023-01-12 11:12:31 +00:00

39 lines
1.2 KiB
Diff

Index: pook-1.1.0/pook/activate_async.py
===================================================================
--- pook-1.1.0.orig/pook/activate_async.py
+++ pook-1.1.0/pook/activate_async.py
@@ -1,5 +1,5 @@
import functools
-from asyncio import iscoroutinefunction, coroutine
+from asyncio import iscoroutinefunction
def activate_async(fn, _engine):
@@ -13,13 +13,13 @@ def activate_async(fn, _engine):
Returns:
function: decorator wrapper function.
"""
- @coroutine
@functools.wraps(fn)
- def wrapper(*args, **kw):
+ async def wrapper(*args, **kw):
_engine.activate()
try:
if iscoroutinefunction(fn):
- yield from fn(*args, **kw) # noqa
+ async for v in fn(*args, **kw):
+ yield v
else:
fn(*args, **kw)
finally:
Index: pook-1.1.0/tests/unit/mock_test.py
===================================================================
--- pook-1.1.0.orig/tests/unit/mock_test.py
+++ pook-1.1.0/tests/unit/mock_test.py
@@ -19,4 +19,4 @@ def test_mock_url(mock):
def test_new_response(mock):
- assert(mock.reply() != mock.reply(new_response=True, json={}))
+ assert mock.reply() != mock.reply(new_response=True, json={})