diff --git a/tests/cli/test_generate.py b/tests/cli/test_generate.py index 757ad05..c00b5ba 100644 --- a/tests/cli/test_generate.py +++ b/tests/cli/test_generate.py @@ -3,30 +3,33 @@ 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(): ... -''' - ) +def test_generate_command(cli_runner): + with cli_runner.isolated_filesystem(): + cwd = Path.cwd() - docs_dir = tmp_path / "docs" + # Create package structure + pkg = cwd / "testpkg" + pkg.mkdir() + (pkg / "__init__.py").write_text("") + (pkg / "mod.py").write_text("def f(): ...\n") - result = cli_runner.invoke( - cli, - [ - "generate", - "--modules", - "testpkg.mod", - "--docs-dir", - str(docs_dir), - ], - ) + docs_dir = cwd / "docs" - assert result.exit_code == 0 + result = cli_runner.invoke( + cli, + [ + "generate", + "--module", + "testpkg", + "--docs-dir", + str(docs_dir), + ], + ) - md = docs_dir / "testpkg" / "mod.md" - assert md.exists() + assert result.exit_code == 0 - content = md.read_text() - assert "::: testpkg.mod" in content + md = docs_dir / "testpkg" / "mod.md" + assert md.exists() + + content = md.read_text() + assert "::: testpkg.mod" in content