33 lines
613 B
Python
33 lines
613 B
Python
from pathlib import Path
|
|
|
|
from docforge.cli.main import cli
|
|
|
|
|
|
def test_generate_command(cli_runner, temp_package, tmp_path: Path):
|
|
(temp_package / "mod.py").write_text(
|
|
'''
|
|
def f(): ...
|
|
'''
|
|
)
|
|
|
|
docs_dir = tmp_path / "docs"
|
|
|
|
result = cli_runner.invoke(
|
|
cli,
|
|
[
|
|
"generate",
|
|
"--modules",
|
|
"testpkg.mod",
|
|
"--docs-dir",
|
|
str(docs_dir),
|
|
],
|
|
)
|
|
|
|
assert result.exit_code == 0
|
|
|
|
md = docs_dir / "testpkg" / "mod.md"
|
|
assert md.exists()
|
|
|
|
content = md.read_text()
|
|
assert "::: testpkg.mod" in content
|