Coverage for tests/test_tutorial/test_exceptions/test_tutorial004.py: 100%
17 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 os 1abcdefghi
2import subprocess 1abcdefghi
3import sys 1abcdefghi
4from pathlib import Path 1abcdefghi
6from typer.testing import CliRunner 1abcdefghi
8from docs_src.exceptions import tutorial004 as mod 1abcdefghi
10runner = CliRunner() 1abcdefghi
13def test_rich_pretty_exceptions_disable(): 1abcdefghi
14 file_path = Path(mod.__file__) 1abcdefghi
15 result = subprocess.run( 1abcdefghi
16 [sys.executable, "-m", "coverage", "run", str(file_path)],
17 capture_output=True,
18 encoding="utf-8",
19 env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},
20 )
21 assert "return get_command(self)(*args, **kwargs)" in result.stderr 1abcdefghi
23 assert "app()" in result.stderr 1abcdefghi
24 assert "print(name + 3)" in result.stderr 1abcdefghi
25 assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr 1abcdefghi
28def test_script(): 1abcdefghi
29 result = subprocess.run( 1abcdefghi
30 [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
31 capture_output=True,
32 encoding="utf-8",
33 )
34 assert "Usage" in result.stdout 1abcdefghi