|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -import subprocess |
6 | | -import unittest |
| 5 | +import subprocess as sp |
7 | 6 |
|
8 | 7 |
|
9 | | -class test_cli(unittest.TestCase): |
10 | | - def test_cli_init(self): |
11 | | - """Tests that the CLI `spice_init` runs.""" |
12 | | - res = subprocess.run(["spice_init", "--help"], check=True) |
13 | | - self.assertEqual(res.returncode, 0) |
| 8 | +def run_cli_help(cmd: str) -> bool: |
| 9 | + res = sp.run([cmd, "--help"], check=True) |
| 10 | + return res.returncode == 0 |
14 | 11 |
|
15 | | - def test_cli_process(self): |
16 | | - """Tests that the CLI `spice_process` runs.""" |
17 | | - res = subprocess.run(["spice_process", "--help"], check=True) |
18 | | - self.assertEqual(res.returncode, 0) |
19 | 12 |
|
| 13 | +def test_cli_init() -> None: |
| 14 | + assert run_cli_help("spice_init") |
20 | 15 |
|
21 | | -if __name__ == "__main__": |
22 | | - unittest.main() |
| 16 | + |
| 17 | +def test_cli_process() -> None: |
| 18 | + assert run_cli_help("spice_process") |
| 19 | + |
| 20 | + |
| 21 | +def test_cli_region() -> None: |
| 22 | + assert run_cli_help("spice_region") |
| 23 | + |
| 24 | + |
| 25 | +def test_cli_cat() -> None: |
| 26 | + assert run_cli_help("spice_cat") |
| 27 | + |
| 28 | + |
| 29 | +def test_cli_image() -> None: |
| 30 | + assert run_cli_help("spice_image") |
0 commit comments