Coverage for tests/test_cli/test_extending_app.py: 100%
22 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
5def test_script_help(): 1abcdefghi
6 result = subprocess.run( 1abcdefghi
7 [
8 sys.executable,
9 "-m",
10 "coverage",
11 "run",
12 "-m",
13 "typer",
14 "tests/assets/cli/extended_app_cli.py",
15 "run",
16 "--help",
17 ],
18 capture_output=True,
19 encoding="utf-8",
20 )
21 assert "top" in result.stdout 1abcdefghi
22 assert "hello" in result.stdout 1abcdefghi
23 assert "sub" in result.stdout 1abcdefghi
26def test_script_top(): 1abcdefghi
27 result = subprocess.run( 1abcdefghi
28 [
29 sys.executable,
30 "-m",
31 "coverage",
32 "run",
33 "-m",
34 "typer",
35 "tests/assets/cli/extended_app_cli.py",
36 "run",
37 "top",
38 ],
39 capture_output=True,
40 encoding="utf-8",
41 )
42 assert "top" in result.stdout 1abcdefghi
45def test_script_hello(): 1abcdefghi
46 result = subprocess.run( 1abcdefghi
47 [
48 sys.executable,
49 "-m",
50 "coverage",
51 "run",
52 "-m",
53 "typer",
54 "tests/assets/cli/extended_app_cli.py",
55 "run",
56 "hello",
57 ],
58 capture_output=True,
59 encoding="utf-8",
60 )
61 assert "hello there" in result.stdout 1abcdefghi
64def test_script_bye(): 1abcdefghi
65 result = subprocess.run( 1abcdefghi
66 [
67 sys.executable,
68 "-m",
69 "coverage",
70 "run",
71 "-m",
72 "typer",
73 "tests/assets/cli/extended_app_cli.py",
74 "run",
75 "bye",
76 ],
77 capture_output=True,
78 encoding="utf-8",
79 )
80 assert "bye" in result.stdout 1abcdefghi
83def test_script_sub_command_help(): 1abcdefghi
84 result = subprocess.run( 1abcdefghi
85 [
86 sys.executable,
87 "-m",
88 "coverage",
89 "run",
90 "-m",
91 "typer",
92 "tests/assets/cli/extended_app_cli.py",
93 "run",
94 "sub",
95 "--help",
96 ],
97 capture_output=True,
98 encoding="utf-8",
99 )
100 assert "sub-sub-command" in result.stdout 1abcdefghi
103def test_script_sub_sub_command(): 1abcdefghi
104 result = subprocess.run( 1abcdefghi
105 [
106 sys.executable,
107 "-m",
108 "coverage",
109 "run",
110 "-m",
111 "typer",
112 "tests/assets/cli/extended_app_cli.py",
113 "run",
114 "sub",
115 "sub-sub-command",
116 ],
117 capture_output=True,
118 encoding="utf-8",
119 )
120 assert "sub_sub_command" in result.stdout 1abcdefghi