PYTHONPython

conftest

real world projects / discord bot / tests

PYTHON
conftest.py🐍
"""
Pytest configuration and fixtures for Discord bot tests.
"""

import pytest
import asyncio
import sys
import os

# Add bot package to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


@pytest.fixture(scope="session")
def event_loop():
    """Create an event loop for async tests."""
    loop = asyncio.get_event_loop_policy().new_event_loop()
    yield loop
    loop.close()
PreviousNext