Coverage for tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py: 100%
16 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-04-14 00:18 +0000
1import subprocess 1abcdefghi
2import sys 1abcdefghi
4import typer 1abcdefghi
5from typer.testing import CliRunner 1abcdefghi
7from docs_src.multiple_values.arguments_with_multiple_values import tutorial001 as mod 1abcdefghi
9runner = CliRunner() 1abcdefghi
10app = typer.Typer() 1abcdefghi
11app.command()(mod.main) 1abcdefghi
14def test_main(): 1abcdefghi
15 result = runner.invoke(app, ["README.md", "pyproject.toml", "woohoo!"]) 1abcdefghi
16 assert result.exit_code == 0 1abcdefghi
17 assert "This file exists: README.md\nwoohoo!" in result.output 1abcdefghi
18 assert "This file exists: pyproject.toml\nwoohoo!" in result.output 1abcdefghi
21def test_script(): 1abcdefghi
22 result = subprocess.run( 1abcdefghi
23 [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
24 capture_output=True,
25 encoding="utf-8",
26 )
27 assert "Usage" in result.stdout 1abcdefghi