Files
mandy/tests/test_saves_import_args.py
quackottu 89277cdac0 saves import, anim_index --rigs: a missing value or unwritable path is an error line, not a traceback
saves.py import with --out or --map as the last argument raised
StopIteration; anim_index.py --rigs into a missing folder raised
FileNotFoundError. Both now give the tools' usual one-line error.
2026-11-22 13:10:26 +05:30

29 lines
965 B
Python

"""saves.py import: an option given without its value is a one-line error, not a StopIteration traceback.
python -I tests/test_saves_import_args.py
"""
import os
import subprocess
import sys
import tempfile
import unittest
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TOOL = os.path.join(ROOT, "tools", "saves.py")
class ImportMissingValueTest(unittest.TestCase):
def test_trailing_option_without_value(self):
with tempfile.TemporaryDirectory() as d:
for flag in ("--out", "--map"):
with self.subTest(flag=flag):
r = subprocess.run([sys.executable, "-I", TOOL, "import", d, flag],
capture_output=True, text=True)
self.assertEqual(r.returncode, 2, r.stderr)
self.assertNotIn("Traceback", r.stderr)
self.assertIn(flag, r.stderr)
if __name__ == "__main__":
unittest.main()