Files
AnyImage/tests/tools/test_docs.py
nan f48bbb3d05 Add tests for image layer, image plane, inventory, saved layout, commands, documentation, manifest, and packaging
- Implement tests for image layer functionality including alpha curve and depth layer behavior.
- Create tests for image plane evaluation and modifier input handling.
- Add tests to verify the saved asset inventory and its persistence.
- Introduce tests for the documentation command to ensure correct project version deployment.
- Validate the extension manifest structure and required permissions.
- Develop tests for the packaging process, ensuring correct platform handling and dependency management.
- Enhance image depth plane group functionality with new split threshold input and surface processing.
2026-09-09 22:18:59 +08:00

43 lines
1.0 KiB
Python

from tests.support.paths import PROJECT_ROOT
import importlib.util
SCRIPT_PATH = PROJECT_ROOT / "tools" / "docs.py"
SPEC = importlib.util.spec_from_file_location("docs_script", SCRIPT_PATH)
docs = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(docs)
def test_documentation_command_deploys_project_version(monkeypatch):
monkeypatch.setattr(docs, "project_version", lambda: "1.2.3")
assert docs.documentation_command() == [
"mike",
"deploy",
"--update-aliases",
"1.2.3",
"latest",
]
def test_documentation_command_previews_current_source():
assert docs.documentation_command(dev=True) == ["mkdocs", "serve"]
def test_main_runs_from_project_root(monkeypatch):
calls = []
monkeypatch.setattr(
docs.subprocess,
"run",
lambda *args, **kwargs: calls.append((args, kwargs)),
)
docs.main(["-dev"])
assert calls == [
(
(["mkdocs", "serve"],),
{"cwd": docs.PROJECT_ROOT, "check": True},
)
]