Coverage for tests/test_cli/test_extending_empty_app.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-04-14 00:18 +0000

1import subprocess 1abcdefghi

2import sys 1abcdefghi

3 

4 

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_empty_app_cli.py", 

15 "run", 

16 "--help", 

17 ], 

18 capture_output=True, 

19 encoding="utf-8", 

20 ) 

21 assert "hello" in result.stdout 1abcdefghi

22 

23 

24def test_script_hello(): 1abcdefghi

25 result = subprocess.run( 1abcdefghi

26 [ 

27 sys.executable, 

28 "-m", 

29 "coverage", 

30 "run", 

31 "-m", 

32 "typer", 

33 "tests/assets/cli/extended_empty_app_cli.py", 

34 "run", 

35 "hello", 

36 ], 

37 capture_output=True, 

38 encoding="utf-8", 

39 ) 

40 assert "hello there" in result.stdout 1abcdefghi

41 

42 

43def test_script_bye(): 1abcdefghi

44 result = subprocess.run( 1abcdefghi

45 [ 

46 sys.executable, 

47 "-m", 

48 "coverage", 

49 "run", 

50 "-m", 

51 "typer", 

52 "tests/assets/cli/extended_empty_app_cli.py", 

53 "run", 

54 "bye", 

55 ], 

56 capture_output=True, 

57 encoding="utf-8", 

58 ) 

59 assert "bye" in result.stdout 1abcdefghi