Coverage for tests / test_tutorial / test_exceptions / test_tutorial003.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
1import os 1abcdefghij
2import subprocess 1abcdefghij
3import sys 1abcdefghij
4from pathlib import Path 1abcdefghij
6from typer.testing import CliRunner 1abcdefghij
8from docs_src.exceptions import tutorial003 as mod 1abcdefghij
10runner = CliRunner() 1abcdefghij
13def test_traceback_rich_pretty_short_disable(): 1abcdefghij
14 file_path = Path(mod.__file__) 1abcdefghij
15 result = subprocess.run( 1abcdefghij
16 [sys.executable, "-m", "coverage", "run", str(file_path)],
17 capture_output=True,
18 encoding="utf-8",
19 env={
20 **os.environ,
21 "TYPER_STANDARD_TRACEBACK": "",
22 "_TYPER_STANDARD_TRACEBACK": "",
23 },
24 )
25 assert "return get_command(self)(*args, **kwargs)" not in result.stderr 1abcdefghij
27 assert "app()" in result.stderr 1abcdefghij
28 assert "print(name + 3)" in result.stderr 1abcdefghij
29 assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr 1abcdefghij
30 assert "name = 'morty'" not in result.stderr 1abcdefghij
33def test_script(): 1abcdefghij
34 result = subprocess.run( 1abcdefghij
35 [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
36 capture_output=True,
37 encoding="utf-8",
38 )
39 assert "Usage" in result.stdout 1abcdefghij