AI-Snake-Game/tests/conftest.py

29 lines
643 B
Python

import pytest
import pygame
import sys
import os
# Add src directory to Python path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
@pytest.fixture(autouse=True)
def pygame_init():
"""Initialize pygame for all tests"""
pygame.init()
yield
pygame.quit()
@pytest.fixture
def game_config():
"""Basic game configuration"""
return {
'width': 800,
'height': 600,
'block_size': 20,
'fps': 60
}
@pytest.fixture
def mock_screen(game_config):
"""Create a mock pygame screen"""
return pygame.Surface((game_config['width'], game_config['height']))