"""Unit tests for make_game.py's packaged-container message: a store .xvc (an XVD file) given as --game, found by --find, or sitting alone in the folder given, is named as an encrypted container instead of "not found". The headers are synthetic: 4 KiB with only the fields make_game reads. No game file is needed. python -I tests/test_make_game_container.py """ import io import os import struct import sys import tempfile import unittest from contextlib import redirect_stderr, redirect_stdout from unittest.mock import patch ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if ROOT not in sys.path: sys.path.insert(0, ROOT) import make_game def xvd_bytes(*, flags=0x41, content_type=1, xvc_data_length=0x1000, version=(1, 2, 0, 1), magic=b"msft-xvd", size=0x1000): """A synthetic XVD header: zero signature, then the fields make_game reads at their file offsets.""" b = bytearray(max(size, 0x1000)) b[0x200:0x208] = magic struct.pack_into("