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

19 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import subprocess 1abcdefgh

2import sys 1abcdefgh

3 

4 

5def test_script_help(): 1abcdefgh

6 result = subprocess.run( 1abcdefgh

7 [ 

8 sys.executable, 

9 "-m", 

10 "coverage", 

11 "run", 

12 "-m", 

13 "typer", 

14 "tests/assets/cli/multi_app_cli.py", 

15 "run", 

16 "--help", 

17 ], 

18 capture_output=True, 

19 encoding="utf-8", 

20 ) 

21 assert "sub" in result.stdout 1abcdefgh

22 assert "top" in result.stdout 1abcdefgh

23 

24 

25def test_script_sub(): 1abcdefgh

26 result = subprocess.run( 1abcdefgh

27 [ 

28 sys.executable, 

29 "-m", 

30 "coverage", 

31 "run", 

32 "-m", 

33 "typer", 

34 "tests/assets/cli/multi_app_cli.py", 

35 "run", 

36 "sub", 

37 "--help", 

38 ], 

39 capture_output=True, 

40 encoding="utf-8", 

41 ) 

42 assert "bye" in result.stdout 1abcdefgh

43 assert "hello" in result.stdout 1abcdefgh

44 

45 

46def test_script_top(): 1abcdefgh

47 result = subprocess.run( 1abcdefgh

48 [ 

49 sys.executable, 

50 "-m", 

51 "coverage", 

52 "run", 

53 "-m", 

54 "typer", 

55 "tests/assets/cli/multi_app_cli.py", 

56 "run", 

57 "top", 

58 ], 

59 capture_output=True, 

60 encoding="utf-8", 

61 ) 

62 assert "top" in result.stdout 1abcdefgh

63 

64 

65def test_script_sub_hello(): 1abcdefgh

66 result = subprocess.run( 1abcdefgh

67 [ 

68 sys.executable, 

69 "-m", 

70 "coverage", 

71 "run", 

72 "-m", 

73 "typer", 

74 "tests/assets/cli/multi_app_cli.py", 

75 "run", 

76 "sub", 

77 "hello", 

78 ], 

79 capture_output=True, 

80 encoding="utf-8", 

81 ) 

82 assert "sub hello" in result.stdout 1abcdefgh

83 

84 

85def test_script_sub_bye(): 1abcdefgh

86 result = subprocess.run( 1abcdefgh

87 [ 

88 sys.executable, 

89 "-m", 

90 "coverage", 

91 "run", 

92 "-m", 

93 "typer", 

94 "tests/assets/cli/multi_app_cli.py", 

95 "run", 

96 "sub", 

97 "bye", 

98 ], 

99 capture_output=True, 

100 encoding="utf-8", 

101 ) 

102 assert "sub bye" in result.stdout 1abcdefgh