Files
mandy/tests/test_anim_index_rigs_write.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

34 lines
1.2 KiB
Python

"""anim_index.py --rigs: an unwritable --rigs path is a one-line error, as for the index output, not a traceback.
python -I tests/test_anim_index_rigs_write.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", "anim_index.py")
sys.path.insert(0, os.path.join(ROOT, "tests"))
from test_anim_index import rbf0_blob # noqa: E402
class RigsWriteTest(unittest.TestCase):
def test_unwritable_rigs_path(self):
with tempfile.TemporaryDirectory() as d:
carve = os.path.join(d, "carve")
os.mkdir(carve)
with open(os.path.join(carve, "00001000.bin"), "wb") as f:
f.write(rbf0_blob())
rigs = os.path.join(d, "missing", "rigs.json")
r = subprocess.run([sys.executable, "-I", TOOL, carve, os.path.join(d, "index.json"),
"--rigs", rigs, "--quiet"], capture_output=True, text=True)
self.assertNotEqual(r.returncode, 0)
self.assertNotIn("Traceback", r.stderr)
self.assertIn("rigs.json", r.stderr)
if __name__ == "__main__":
unittest.main()