fixture-repository coverage for the testing strategy

This commit is contained in:
2026-04-26 02:41:44 +02:00
parent 8538e0b6fc
commit 9cd700b215
3 changed files with 79 additions and 0 deletions

41
tests/fixtures.py Normal file
View File

@@ -0,0 +1,41 @@
from pathlib import Path
def write_readme_only_repo(root: Path) -> Path:
repo = root / "readme-only"
repo.mkdir()
(repo / "README.md").write_text(
"# Readme Only\n\nThis repository describes a planned interface.\n",
encoding="utf-8",
)
return repo
def write_python_cli_repo(root: Path) -> Path:
repo = root / "python-cli"
repo.mkdir()
(repo / "README.md").write_text("# Python CLI\n", encoding="utf-8")
(repo / "requirements.txt").write_text("click\npytest\n", encoding="utf-8")
(repo / "cli.py").write_text(
"import click\n\n"
"@click.command()\n"
"def main():\n"
" click.echo('ok')\n",
encoding="utf-8",
)
(repo / "tests").mkdir()
(repo / "tests" / "test_cli.py").write_text(
"def test_cli(): pass\n",
encoding="utf-8",
)
return repo
def write_misleading_docs_repo(root: Path) -> Path:
repo = root / "misleading-docs"
repo.mkdir()
(repo / "README.md").write_text(
"# Misleading Docs\n\nClaims to provide payments and search, but has no code.\n",
encoding="utf-8",
)
return repo