Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# License: MIT
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH

"""Simple test for the BaseActor."""
"""Tests for the asyncio module."""

import asyncio
from collections.abc import Iterator
from typing import Literal, assert_never

import async_solipsism
Expand All @@ -12,13 +12,11 @@
from frequenz.core.asyncio import BackgroundService


# Setting 'autouse' has no effect as this method replaces the event loop for all tests in the file.
@pytest.fixture()
def event_loop() -> Iterator[async_solipsism.EventLoop]:
"""Replace the loop with one that doesn't interact with the outside world."""
loop = async_solipsism.EventLoop()
yield loop
loop.close()
# This method replaces the event loop for all tests in the file.
@pytest.fixture
def event_loop_policy() -> async_solipsism.EventLoopPolicy:
"""Return an event loop policy that uses the async solipsism event loop."""
return async_solipsism.EventLoopPolicy()


class FakeService(BackgroundService):
Expand Down