Skip to content

Tests fail with python 3.11 or greater / pytest 8.3 / modern pytest_asyncio #217

Description

@MeggyCal

The tests in test/aio folder fail. I got around most of the failures with the patch lower on this page, but still I encounter some problems which I cannot resolve myself. Could you please take a look?

  • test_workspace gets stuck for some reason
  • test_event_exception and test_tick_event fail with RuntimeError: Task (...) got Future <Future pending> attached to a different loop

Patch:

Index: i3ipc-python-2.2.1/test/aio/ipctest.py
===================================================================
--- i3ipc-python-2.2.1.orig/test/aio/ipctest.py
+++ i3ipc-python-2.2.1/test/aio/ipctest.py
@@ -1,5 +1,9 @@
 from subprocess import Popen
 import pytest
+try:
+    from pytest_asyncio import fixture
+except ImportError:
+    from pytest import fixture

 from i3ipc.aio import Connection
 from i3ipc import CommandReply
@@ -15,11 +19,11 @@ class IpcTest:
     timeout_thread = None
     i3_conn = None

-    @pytest.fixture(scope='class')
+    @fixture(scope='class')
     def event_loop(self):
         return asyncio.get_event_loop()

-    @pytest.fixture(scope='class')
+    @fixture(scope='class')
     async def i3(self):
         process = Popen(['i3', '-c', 'test/i3.config'])
         # wait for i3 to start up

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions