upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKoro4e <96347170+Koro4e@users.noreply.github.com>2026-11-23 17:00:20 +0100
committerGitHub <noreply@github.com>2026-11-23 10:00:20 -0600
commitb66e184ebe9e6c12f6fa60faf2cf32e042d8cd2a (patch)
tree104194338b1096e11ef9a680347b25f0204f4cb7 /tests
parentd8e8f23b975b6c7d383125ace7378cba3dbffe38 (diff)
batch_glb: --textures must name a directory (#6747)
Squash-merged after diff review of PR #6747 - batch_glb: --textures must name a directory
Diffstat (limited to 'tests')
-rw-r--r--tests/test_batch_glb.py19
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")