14
0

- Add python-311.patch to support python 3.11

gh#syrusakbary/promise#99

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-promise?expand=0&rev=11
This commit is contained in:
2023-02-24 11:23:34 +00:00
committed by Git OBS Bridge
parent 9e337e76a6
commit 965c333517
3 changed files with 51 additions and 3 deletions

41
python-311.patch Normal file
View File

@@ -0,0 +1,41 @@
diff --git a/tests/test_awaitable.py b/tests/test_awaitable.py
index aad7f2c..a14a181 100644
--- a/tests/test_awaitable.py
+++ b/tests/test_awaitable.py
@@ -1,18 +1,15 @@
-from asyncio import coroutine
from pytest import mark
from time import sleep
from promise import Promise
@mark.asyncio
-@coroutine
-def test_await():
- yield from Promise.resolve(True)
+async def test_await():
+ await Promise.resolve(True)
@mark.asyncio
-@coroutine
-def test_await_time():
+async def test_await_time():
def resolve_or_reject(resolve, reject):
sleep(.1)
resolve(True)
@@ -22,11 +19,9 @@ def resolve_or_reject(resolve, reject):
@mark.asyncio
-@coroutine
-def test_promise_coroutine():
- @coroutine
- def my_coro():
- yield from Promise.resolve(True)
+async def test_promise_coroutine():
+ async def my_coro():
+ await Promise.resolve(True)
promise = Promise.resolve(my_coro())
assert isinstance(promise, Promise)