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

10 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 "--app", 

15 "sub_app", 

16 "tests/assets/cli/multi_app.py", 

17 "run", 

18 "--help", 

19 ], 

20 capture_output=True, 

21 encoding="utf-8", 

22 ) 

23 assert "bye" in result.stdout 1abcdefgh

24 assert "hello" in result.stdout 1abcdefgh

25 assert "top" not in result.stdout 1abcdefgh

26 

27 

28def test_script(): 1abcdefgh

29 result = subprocess.run( 1abcdefgh

30 [ 

31 sys.executable, 

32 "-m", 

33 "coverage", 

34 "run", 

35 "-m", 

36 "typer", 

37 "--app", 

38 "sub_app", 

39 "tests/assets/cli/multi_app.py", 

40 "run", 

41 "hello", 

42 ], 

43 capture_output=True, 

44 encoding="utf-8", 

45 ) 

46 assert "Hello World" in result.stdout 1abcdefgh