diff options
Diffstat (limited to 'tests/test_batch_glb.py')
| -rw-r--r-- | tests/test_batch_glb.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_batch_glb.py b/tests/test_batch_glb.py index 06940a597..6cc3bd416 100644 --- a/tests/test_batch_glb.py +++ b/tests/test_batch_glb.py | |||
| @@ -83,6 +83,25 @@ class TestBatchGlb(unittest.TestCase): | |||
| 83 | self.assertIn(error, result.stderr) | 83 | self.assertIn(error, result.stderr) |
| 84 | self.assertEqual(result.stdout, "") | 84 | self.assertEqual(result.stdout, "") |
| 85 | 85 | ||
| 86 | def test_a_textures_path_that_is_not_a_directory_is_a_usage_error(self) -> None: | ||
| 87 | # before the validator a typo'd --textures path returned an empty index and the run still | ||
| 88 | # embedded nothing and exited 0, as if the folder had no textures. | ||
| 89 | with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: | ||
| 90 | with open(os.path.join(in_dir, "m.obj"), "w", encoding="utf-8", newline="\n") as f: | ||
| 91 | f.write("o m\nv 0 0 0\nv 1 0 0\nv 0 1 0\nf 1 2 3\n") | ||
| 92 | not_a_dir = os.path.join(in_dir, "textures.txt") | ||
| 93 | with open(not_a_dir, "wb") as f: | ||
| 94 | f.write(b"x") | ||
| 95 | result = subprocess.run( | ||
| 96 | [sys.executable, "-I", os.path.join(TOOLS, "batch_glb.py"), | ||
| 97 | in_dir, out_dir, "--textures", not_a_dir], | ||
| 98 | capture_output=True, text=True, check=False, | ||
| 99 | ) | ||
| 100 | self.assertEqual(result.returncode, 2, result.stderr) | ||
| 101 | self.assertIn("argument --textures", result.stderr) | ||
| 102 | self.assertIn("not a directory", result.stderr) | ||
| 103 | self.assertEqual(os.listdir(out_dir), []) | ||
| 104 | |||
| 86 | def test_cli_accepts_valid_jobs_and_max_tex_size(self) -> None: | 105 | def test_cli_accepts_valid_jobs_and_max_tex_size(self) -> None: |
| 87 | with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: | 106 | with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: |
| 88 | obj_path = os.path.join(in_dir, "test_model.obj") | 107 | obj_path = os.path.join(in_dir, "test_model.obj") |