generated from coulomb/repo-seed
fixture-repository coverage for the testing strategy
This commit is contained in:
41
tests/fixtures.py
Normal file
41
tests/fixtures.py
Normal 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
|
||||
Reference in New Issue
Block a user