Skip to content

Commit

Permalink
Clean pytest fixture event loop access (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHjelmare authored Dec 27, 2024
1 parent 29bc639 commit 8e69eaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Set up common fixtures and helpers for pytest."""

import asyncio
from unittest.mock import Mock

import pytest
Expand All @@ -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

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 8e69eaa

Please sign in to comment.