Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Dec 12, 2024
1 parent dd7edfd commit c687a85
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 122 deletions.
3 changes: 0 additions & 3 deletions tests/assets/cli/multi_app_norich.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def hello(name: str = "World", age: int = typer.Option(0, help="The age of the u
"""
Say Hello
"""
typer.echo(f"Hello {name}")


@sub_app.command()
Expand All @@ -25,7 +24,6 @@ def bye():
"""
Say bye
"""
typer.echo("sub bye")


app = typer.Typer(help="Demo App", epilog="The end", rich_markup_mode=None)
Expand All @@ -37,4 +35,3 @@ def top():
"""
Top command
"""
typer.echo("top")
102 changes: 0 additions & 102 deletions tests/assets/cli/multiapp-docs-norich.md

This file was deleted.

34 changes: 17 additions & 17 deletions tests/test_cli/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def test_doc():
assert "**Arguments**" in result.stdout


def test_doc_no_rich():
def test_doc_output(tmp_path: Path):
out_file: Path = tmp_path / "out.md"
result = subprocess.run(
[
sys.executable,
Expand All @@ -37,22 +38,25 @@ def test_doc_no_rich():
"run",
"-m",
"typer",
"tests.assets.cli.multi_app_norich",
"tests.assets.cli.multi_app",
"utils",
"docs",
"--name",
"multiapp",
"--output",
str(out_file),
],
capture_output=True,
encoding="utf-8",
)
docs_path: Path = Path(__file__).parent.parent / "assets/cli/multiapp-docs.md"
docs = docs_path.read_text()
assert docs in result.stdout
assert "**Arguments**" in result.stdout
written_docs = out_file.read_text()
assert docs in written_docs
assert "Docs saved to:" in result.stdout


def test_doc_output(tmp_path: Path):
def test_doc_title_output(tmp_path: Path):
out_file: Path = tmp_path / "out.md"
result = subprocess.run(
[
Expand All @@ -67,21 +71,22 @@ def test_doc_output(tmp_path: Path):
"docs",
"--name",
"multiapp",
"--title",
"Awesome CLI",
"--output",
str(out_file),
],
capture_output=True,
encoding="utf-8",
)
docs_path: Path = Path(__file__).parent.parent / "assets/cli/multiapp-docs.md"
docs_path: Path = Path(__file__).parent.parent / "assets/cli/multiapp-docs-title.md"
docs = docs_path.read_text()
written_docs = out_file.read_text()
assert docs in written_docs
assert "Docs saved to:" in result.stdout


def test_doc_title_output(tmp_path: Path):
out_file: Path = tmp_path / "out.md"
def test_doc_no_rich():
result = subprocess.run(
[
sys.executable,
Expand All @@ -90,24 +95,19 @@ def test_doc_title_output(tmp_path: Path):
"run",
"-m",
"typer",
"tests.assets.cli.multi_app",
"tests.assets.cli.multi_app_norich",
"utils",
"docs",
"--name",
"multiapp",
"--title",
"Awesome CLI",
"--output",
str(out_file),
],
capture_output=True,
encoding="utf-8",
)
docs_path: Path = Path(__file__).parent.parent / "assets/cli/multiapp-docs-title.md"
docs_path: Path = Path(__file__).parent.parent / "assets/cli/multiapp-docs.md"
docs = docs_path.read_text()
written_docs = out_file.read_text()
assert docs in written_docs
assert "Docs saved to:" in result.stdout
assert docs in result.stdout
assert "**Arguments**" in result.stdout


def test_doc_not_existing():
Expand Down

0 comments on commit c687a85

Please sign in to comment.