Files
023-turtle-crossing/tests/conftest.py
T
Tirsvad 71498a9f67 Add the Player class and the Up key binding
Task: MIL-003#1
Task: MIL-003#2
Task: MIL-003#3
2026-10-13 13:56:40 +08:00

19 lines
496 B
Python

"""Shared fixtures. Tests that need a window skip when no display is available."""
import tkinter
import turtle
import pytest
@pytest.fixture(scope="session")
def screen() -> turtle.TurtleScreen:
"""A single hidden turtle screen shared by the tests that draw."""
try:
game_screen = turtle.Screen()
except tkinter.TclError:
pytest.skip("no display available")
game_screen.tracer(0)
game_screen.getcanvas().winfo_toplevel().withdraw()
return game_screen