mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 21:04:18 +01:00
Previously uncommitted work: the game always runs in real time (no pause or time acceleration), web client fixes (plot smoothing, spectrum peak labels shared with the uConsole), regenerated contact-analysis images, docs and manual updates. UI/realism review, phase 1 (no truth leaks): - Sonar CIC domain follows only the operator classification; new TORPEDO class. - Torpedo alarm from intercepts only (launch transient, HF seeker pulses), used by Bridge, Autocrew and the web Bridge threat block. - ASM cue from measured speed/altitude or a jamming strobe; CIWS/ESSM/ECM resolve missiles through their own M- tracks. - HFDF fixes publish no domain; lookout domain needs recognition. - No "hostile ping"/"submarine sunk" reports: breaking-up noises on a bearing; score only in the debrief. - Helicopter layer shown only after the dome passed it; web Bridge gets published rows only. Phase 2 (uConsole screen and text): - Status ticker (default) frees 158 px; F11 event log/telemetry overlay (display only); docked band selectable in the options. - Layout helpers fall back to catalog abbreviations (<key>.short) before any ellipsis; feed wraps, ticker scrolls; zero truncations EN/DE. - Localised telemetry and OPZ affiliation/domain codes, bounded map labels. Web: role map and chart draw NATO affiliation frames with domain glyphs. Tests: truth boundary, text fit, session-wide preferences isolation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""pytest-Setup: Projektroot auf sys.path + headlose SDL-Treiber."""
|
|
|
|
import os
|
|
import sys
|
|
from tempfile import TemporaryDirectory
|
|
|
|
import pytest
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
os.environ.setdefault("SDL_VIDEODRIVER", "dummy")
|
|
os.environ.setdefault("SDL_AUDIODRIVER", "dummy")
|
|
|
|
|
|
def pytest_configure(config):
|
|
from src.core import config as game_config
|
|
|
|
# Protect collection and session fixtures as well as individual tests.
|
|
saves = TemporaryDirectory(prefix="u-jagd-pytest-")
|
|
config.add_cleanup(saves.cleanup)
|
|
patch = pytest.MonkeyPatch()
|
|
config.add_cleanup(patch.undo)
|
|
patch.setattr(game_config, "SAVE_DIR", saves.name)
|
|
patch.setattr(game_config, "SAVE_PATH", os.path.join(saves.name, "save.json"))
|
|
# Session-wide guard as well: nothing in a test run (collection, threads
|
|
# outliving a test, helpers) may write the real ~/.u-jagd/settings.json.
|
|
from pathlib import Path
|
|
from src.core import preferences as preferences_module
|
|
real_path = preferences_module.default_preferences_path
|
|
|
|
def isolated_path():
|
|
return Path(saves.name) / "settings.json"
|
|
|
|
isolated_path.__wrapped__ = real_path
|
|
patch.setattr(preferences_module, "default_preferences_path", isolated_path)
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def isolated_saves(tmp_path, monkeypatch):
|
|
from src.core import config
|
|
from src.core import preferences as preferences_module
|
|
|
|
saves = tmp_path / "saves"
|
|
saves.mkdir()
|
|
monkeypatch.setattr(config, "SAVE_DIR", str(saves))
|
|
monkeypatch.setattr(config, "SAVE_PATH", str(saves / "save.json"))
|
|
monkeypatch.setattr(
|
|
preferences_module, "default_preferences_path",
|
|
lambda: saves / "settings.json")
|
|
return saves
|