From 35a8758a8f40df586a5e9c78b66f1e2acab908a8 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Fri, 27 Dec 2024 17:06:25 +0100 Subject: [PATCH] Clean pytest fixture event loop access --- tests/conftest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index dd831006..82784c15 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ """Set up common fixtures and helpers for pytest.""" +import asyncio from unittest.mock import Mock import pytest @@ -13,9 +14,9 @@ @pytest.fixture(name="center") -async def center_fixture(event_loop): +async def center_fixture(): """Give access to center via fixture.""" - _center = Center(loop=event_loop) + _center = Center(loop=asyncio.get_running_loop()) _center._track_tasks = True # pylint: disable=protected-access return _center @@ -146,7 +147,7 @@ async def on_image(self, center, event): path=event.path, channel_id=event.channel_id, z_slice_id=event.z_slice_id, - **field_args + **field_args, ) await self.set_sample("field", **field_args)