upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/test_batch_glb.py
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:55 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:08:55 -0500
commit2feedae6969fc25d1e3e10e4465cfbc3358ee004 (patch)
treeec0b5382ada5d7f5889adb6dfc7b29288e89dcbd /tests/test_batch_glb.py
parente549ac4c07f37685d56232924deffb94e7237842 (diff)
parent4799d88d756be9625db0503b153873e9737fc895 (diff)
Merge pull request #3852 from bbareth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_batch_glb.py')
-rw-r--r--tests/test_batch_glb.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_batch_glb.py b/tests/test_batch_glb.py
index 997e38c9b..ef1a543ec 100644
--- a/tests/test_batch_glb.py
+++ b/tests/test_batch_glb.py
@@ -62,6 +62,53 @@ class TestBatchGlb(unittest.TestCase):
62 self.assertIn(error, result.stderr) 62 self.assertIn(error, result.stderr)
63 self.assertEqual(len(result.stderr.splitlines()), 1) 63 self.assertEqual(len(result.stderr.splitlines()), 1)
64 64
65 def test_cli_rejects_invalid_jobs_and_max_tex_size(self) -> None:
66 with tempfile.TemporaryDirectory() as root:
67 for flag, value, error in [
68 ("--jobs", "0", "argument --jobs"),
69 ("--jobs", "-1", "argument --jobs"),
70 ("--max-tex-size", "-1", "argument --max-tex-size"),
71 ]:
72 with self.subTest(flag=flag, value=value):
73 result = subprocess.run(
74 [
75 sys.executable, "-I",
76 os.path.join(TOOLS, "batch_glb.py"),
77 root, os.path.join(root, "out"),
78 flag, value,
79 ],
80 capture_output=True, text=True, check=False,
81 )
82 self.assertEqual(result.returncode, 2)
83 self.assertIn(error, result.stderr)
84 self.assertEqual(result.stdout, "")
85
86 def test_cli_accepts_valid_jobs_and_max_tex_size(self) -> None:
87 with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir:
88 obj_path = os.path.join(in_dir, "test_model.obj")
89 with open(obj_path, "w", encoding="utf-8", newline="\n") as f:
90 f.write(
91 "o test\n"
92 "v 0.0 0.0 0.0\n"
93 "v 1.0 0.0 0.0\n"
94 "v 0.0 1.0 0.0\n"
95 "f 1 2 3\n"
96 )
97
98 # zero texture size (unconstrained) and a positive jobs limit are valid
99 result = subprocess.run(
100 [
101 sys.executable, "-I",
102 os.path.join(TOOLS, "batch_glb.py"),
103 in_dir, out_dir,
104 "--jobs", "1",
105 "--max-tex-size", "0",
106 ],
107 capture_output=True, text=True, check=False,
108 )
109 self.assertEqual(result.returncode, 0, result.stderr)
110 self.assertIn("converted 1/1 models", result.stdout)
111
65 def test_batch_convert_synthetic(self) -> None: 112 def test_batch_convert_synthetic(self) -> None:
66 with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir: 113 with tempfile.TemporaryDirectory() as in_dir, tempfile.TemporaryDirectory() as out_dir:
67 for i in range(3): 114 for i in range(3):