-
Notifications
You must be signed in to change notification settings - Fork 56
Labels
Description
Currently the sync API cannot be used in an asyncio event loop. We have an xfailing test which was added in #40 to demonstrate this.
Lines 60 to 64 in 6cf29b2
@pytest.mark.xfail(reason="Cannot run nested event loops", raises=RuntimeError) | |
async def test_version_sync_in_async(): | |
kubernetes = kr8s.api() | |
version = kubernetes.version() | |
assert "major" in version |
This situation will come up a lot in Jupyter as there is always an event loop running but many users may expect to be able to use the sync API and will not consider asyncio at all.
We need to be able to support the sync API (which uses asyncio.run
under the hood) in an event loop.