Files
AnyImage/tests/test_docs.py
nan e7aeeb21d4 Add tools and tests for AnyImage model management and documentation
- Implement sync_models.py for preparing and uploading ONNX artifacts.
- Create build_node.py for building and validating Blender scripts.
- Add docs.py for building and previewing documentation with Mike or MkDocs.
- Introduce model_exports.py for exporting PyTorch models to ONNX format.
- Develop pack.py for packaging the project with dependencies for different platforms.
- Add test_sync_models.py to validate sync_models functionality.
- Add test_tool_commands.py to ensure repository tools have correct command scripts.
- Initialize tools package with __init__.py.
2026-08-31 15:15:33 +08:00

43 lines
1.0 KiB
Python

import importlib.util
from pathlib import Path
SCRIPT_PATH = Path(__file__).resolve().parents[1] / "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},
)
]