"""conftest.py for tests/services/git/

When `test_git_base.py` async tests run in the full suite after other
modules that modify the asyncio event loop, AsyncMock and patch-based
mocks for async functions may not work correctly.

This conftest provides a fixture that forces a fresh asyncio event loop
per test function, avoiding cross-test contamination.
"""

import asyncio
import pytest


@pytest.fixture(scope="function")
def event_loop():
    """Create a fresh event loop for each test function.

    Overrides the default pytest-asyncio event_loop fixture to ensure
    that async git_base tests are isolated from event loop state left
    by other test modules in the full suite.
    """
    policy = asyncio.get_event_loop_policy()
    loop = policy.new_event_loop()
    asyncio.set_event_loop(loop)
    yield loop
    loop.close()
