Files
AnyImage/tests/tools/test_commands.py
nan 27ca25224a feat: Implement depth surface strip cleanup and organize tool CLI
- Added a proposal for depth surface strip cleanup, detailing the rationale and changes to the depth plane and cutout nodes.
- Created specifications for the new cleanup requirements, including scenarios for strip removal and boundary edge detection.
- Developed tasks for implementing shared strip detection logic and integrating new interfaces for depth nodes.
- Established a new CLI structure for organizing node groups and model commands, replacing old entry points with a more intuitive command structure.
- Introduced a prototype for panorama surface generation, including requirements for distance reconstruction and geometry node surfaces.
- Added comprehensive tests for depth strip cleanup functionality, ensuring correct behavior for various mesh topologies and edge cases.
2026-09-10 00:53:43 +08:00

44 lines
1.4 KiB
Python

from tests.support.paths import PROJECT_ROOT
import tomllib
import unittest
import importlib
from unittest.mock import patch
import pytest
@pytest.mark.parametrize("module_name", ["tools.nodes.cli", "tools.models.cli"])
@pytest.mark.parametrize("arguments,code", [([], None), (["--help"], 0), (["unknown"], 2), (["--bad-option"], 2)])
def test_help_and_invalid_arguments_do_not_start_work(module_name, arguments, code, capsys):
module = importlib.import_module(module_name)
with patch("sys.argv", ["tool", *arguments]), patch.object(module.subprocess, "run") as run:
if code is None:
module.main()
else:
with pytest.raises(SystemExit) as error:
module.main()
assert error.value.code == code
run.assert_not_called()
captured = capsys.readouterr()
assert "usage:" in captured.out + captured.err
class ToolCommandsTests(unittest.TestCase):
def test_repository_tools_have_uv_commands(self):
project = tomllib.loads(
(PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8")
)["project"]
self.assertEqual(
project["scripts"],
{
"pack": "tools.pack:main",
"node-group": "tools.nodes.cli:main",
"model": "tools.models.cli:main",
"docs": "tools.docs:main",
},
)
if __name__ == "__main__":
unittest.main()