mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:58:38 +00:00
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.
29 lines
965 B
Python
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()
|