From 864cdb8a0b1f0d3fb5c0d84703fedb2bf1e1491e Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 11 Sep 2023 14:30:28 +0800 Subject: [PATCH] Update test suite to remove use of generators as co-routines. --- changes/78.bugfix.rst | 1 + tests/test_utils.py | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 changes/78.bugfix.rst diff --git a/changes/78.bugfix.rst b/changes/78.bugfix.rst new file mode 100644 index 0000000..ce9e2c8 --- /dev/null +++ b/changes/78.bugfix.rst @@ -0,0 +1 @@ +Support for using a generator as a co-routine has been removed, in line with the change in behavior in Python 3.12. Python 3.11 and earlier will still support this usage, but it is no longer verified as part of GBulb. diff --git a/tests/test_utils.py b/tests/test_utils.py index cad600b..464bb7f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -76,8 +76,7 @@ class TestObject(GObject.GObject): t = TestObject() - def emitter(): - yield + async def emitter(): t.emit("foo", "frozen brains tell no tales") called = False @@ -115,16 +114,16 @@ class TestObject(GObject.GObject): t = TestObject() - def emitter(): - yield + async def emitter(): t.emit("foo", "frozen brains tell no tales") called = False cancelled = False - def waiter(): + async def waiter(): nonlocal cancelled - yield + # Yield to the event loop + await asyncio.sleep(0) r = wait_signal(t, "foo")