mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 19:08:38 +00:00
check_no_game_data.py read `--help` as a path and answered "cannot read --help", exit 2, in the tool every contributor is told to run; it now prints the usage text it already carries and exits 0. play-linux.sh and run_wine_session.sh print their usage before any environment check, where they used to answer with an error (and play-linux.sh's no-argument case still prints the same usage, on stderr, exit 2). run_game_wine.sh's one-line Usage line names the required --shaders, which its Inputs section already listed. A test per script fails on main's copies and passes here.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""scripts/play-linux.sh answers --help with its usage, without a game executable, Wine or a prefix.
|
|
|
|
python -I tests/test_play_linux.py
|
|
|
|
The help path is checked alone: PATH holds nothing but the shell, and no LEONIDA_* variable is set, so a --help that
|
|
fell through to the game start would fail loudly instead of passing. POSIX only; no game files.
|
|
"""
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "play-linux.sh"
|
|
|
|
|
|
@unittest.skipUnless(os.name == "posix" and shutil.which("sh"), "needs a POSIX shell")
|
|
class PlayLinuxHelp(unittest.TestCase):
|
|
def run_help(self, flag: str) -> subprocess.CompletedProcess:
|
|
return subprocess.run(["sh", str(SCRIPT), flag], env={"PATH": "/usr/bin:/bin"},
|
|
capture_output=True, text=True, timeout=60)
|
|
|
|
def test_help_prints_the_usage_and_starts_nothing(self):
|
|
for flag in ("-h", "--help"):
|
|
with self.subTest(flag=flag):
|
|
p = self.run_help(flag)
|
|
self.assertEqual(p.returncode, 0, p.stderr)
|
|
self.assertIn("usage:", p.stdout)
|
|
self.assertIn("--series-x", p.stdout)
|
|
self.assertEqual(p.stderr, "")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|