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

8 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/sample.py", 

15 "--help", 

16 ], 

17 capture_output=True, 

18 encoding="utf-8", 

19 ) 

20 assert "run" in result.stdout 1abcdefgh

21 

22 

23def test_not_python(): 1abcdefgh

24 result = subprocess.run( 1abcdefgh

25 [ 

26 sys.executable, 

27 "-m", 

28 "coverage", 

29 "run", 

30 "-m", 

31 "typer", 

32 "tests/assets/cli/not_python.txt", 

33 "run", 

34 ], 

35 capture_output=True, 

36 encoding="utf-8", 

37 ) 

38 assert "Could not import as Python file" in result.stderr 1abcdefgh