sas2py/tests/test_game.py
2026-04-28 23:40:24 +02:00

20 lines
652 B
Python

import os
# Use the SDL dummy video driver so tests can run headless in CI
os.environ.setdefault("SDL_VIDEODRIVER", "dummy")
import pygame
from game.game import Game
def test_game_initializes_and_runs_briefly():
# Ensure pygame uses the dummy driver
assert pygame.get_sdl_version() is not None
# Instantiate the game and run for a tiny amount of time
g = Game(width=320, height=240, fps=60)
# Run the loop for 0.1 seconds using run(max_run_seconds=...)
g.run(max_run_seconds=0.1)
# If we reached cleanup without exception, consider test passed
assert not pygame.get_init() # pygame.quit() should have been called