import asyncio

import pytest

from kurier.core.basekurier import BaseKurier
from kurier.core.station import Station
from kurier.hermes import Hermes

Hermes.is_enabled = False


@pytest.fixture(autouse=True)
def setup_test_environment():
    """Setup test environment before each test."""
    # Disable Hermes logging during tests
    Hermes.is_enabled = False

    # Clear registries
    Station.station_registry.clear()
    BaseKurier._registry.clear()

    yield

    # Cleanup after test
    Station.station_registry.clear()
    BaseKurier._registry.clear()


@pytest.fixture
def event_loop():
    """Create an instance of the default event loop for the test session."""
    loop = asyncio.new_event_loop()
    yield loop
    loop.close()
