diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 15:15:09 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 15:15:09 -0500 |
| commit | d728b80c3e2a5eecd873f77f27bd051dfa1f665c (patch) | |
| tree | d1617a5fe6aaf9f4515f449b4029a7722f817e04 /tests/test_batch_glb.py | |
| parent | 5b19549ee2cb4ea06bda92a4165015b10bcc15fa (diff) | |
| parent | 23d231b8c678964283fcae64ec60db081fc91143 (diff) | |
Merge pull request #3146 from airp1ane
Diffstat (limited to 'tests/test_batch_glb.py')
| -rw-r--r-- | tests/test_batch_glb.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_batch_glb.py b/tests/test_batch_glb.py index 9056e4e4e..0a42f3c94 100644 --- a/tests/test_batch_glb.py +++ b/tests/test_batch_glb.py | |||
| @@ -9,6 +9,7 @@ import json | |||
| 9 | import os | 9 | import os |
| 10 | from pathlib import Path | 10 | from pathlib import Path |
| 11 | import struct | 11 | import struct |
| 12 | import subprocess | ||
| 12 | import sys | 13 | import sys |
| 13 | import tempfile | 14 | import tempfile |
| 14 | import unittest | 15 | import unittest |
| @@ -39,6 +40,27 @@ def _create_minimal_bc1_dds(color: int = 0xF800) -> bytes: | |||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | class TestBatchGlb(unittest.TestCase): | 42 | class TestBatchGlb(unittest.TestCase): |
| 43 | def test_cli_reports_directory_setup_errors(self) -> None: | ||
| 44 | with tempfile.TemporaryDirectory() as root: | ||
| 45 | missing = os.path.join(root, "missing") | ||
| 46 | blocked = os.path.join(root, "blocked") | ||
| 47 | with open(blocked, "wb"): | ||
| 48 | pass | ||
| 49 | |||
| 50 | for source, output, error in [ | ||
| 51 | (missing, os.path.join(root, "out"), "Input directory does not exist"), | ||
| 52 | (root, blocked, "blocked"), | ||
| 53 | ]: | ||
| 54 | with self.subTest(source=source, output=output): | ||
| 55 | result = subprocess.run( | ||
| 56 | [sys.executable, "-I", os.path.join(TOOLS, "batch_glb.py"), source, output], | ||
| 57 | capture_output=True, text=True, check=False, | ||
| 58 | ) | ||
| 59 | self.assertEqual(result.returncode, 1) | ||
| 60 | self.assertTrue(result.stderr.startswith("ERROR: "), result.stderr) | ||
| 61 | self.assertIn(error, result.stderr) | ||
| 62 | self.assertEqual(len(result.stderr.splitlines()), 1) | ||
| 63 | |||
| 42 | def test_batch_convert_synthetic(self) -> None: | 64 | def test_batch_convert_synthetic(self) -> None: |
| 43 | with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: | 65 | with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: |
| 44 | for i in range(3): | 66 | for i in range(3): |