|
6 | 6 |
|
7 | 7 |
|
8 | 8 | def test_cli_help_runs(): |
| 9 | + """Check help the main command""" |
9 | 10 | with pytest.raises(SystemExit) as exception: |
10 | 11 | main(["--help"]) |
11 | 12 | assert exception.value.code == 0 |
12 | 13 |
|
13 | 14 |
|
14 | 15 | @pytest.mark.skipif(sys.platform.startswith("win"), reason="No man on Windows") |
15 | 16 | def test_man_subcommand_runs(): |
| 17 | + """Check that man subcommand runs without an error""" |
16 | 18 | assert main(["man", "g.region"]) == 0 |
17 | 19 |
|
18 | 20 |
|
| 21 | +def test_subcommand_man_no_page(): |
| 22 | + """argparse gives 2 without parameters""" |
| 23 | + with pytest.raises(SystemExit) as exception: |
| 24 | + main(["man"]) |
| 25 | + assert exception.value.code == 2 |
| 26 | + |
| 27 | + |
19 | 28 | def test_subcommand_run_help(): |
| 29 | + """Check help of a subcommand""" |
20 | 30 | assert main(["run", "--help"]) == 0 |
21 | 31 |
|
22 | 32 |
|
| 33 | +def test_subcommand_run_no_tool(): |
| 34 | + """argparse gives 2 without parameters""" |
| 35 | + assert main(["run"]) == 2 |
| 36 | + |
| 37 | + |
| 38 | +def test_subcommand_run_tool_help(): |
| 39 | + """Check help of a tool""" |
| 40 | + assert main(["run", "g.region", "--help"]) == 0 |
| 41 | + |
| 42 | + |
23 | 43 | def test_subcommand_run_tool_special_flag(): |
| 44 | + """Check that a special flag is supported""" |
24 | 45 | assert main(["run", "g.region", "--interface-description"]) == 0 |
25 | 46 |
|
26 | 47 |
|
27 | 48 | def test_subcommand_run_tool_regular_run(): |
| 49 | + """Check that a tool runs without error""" |
28 | 50 | assert main(["run", "g.region", "-p"]) == 0 |
29 | 51 |
|
30 | 52 |
|
31 | 53 | def test_subcommand_run_tool_failure_run(): |
| 54 | + """Check that a tool produces non-zero return code""" |
32 | 55 | assert main(["run", "g.region", "raster=does_not_exist"]) == 1 |
0 commit comments