Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import subprocess |
||
2 | |||
3 | import pytest |
||
4 | |||
5 | from deepreg import log |
||
6 | |||
7 | logger = log.get(__name__) |
||
8 | |||
9 | |||
10 | def execute_commands(cmds): |
||
11 | for cmd in cmds: |
||
12 | try: |
||
13 | logger.info(f"Running {cmd}") |
||
14 | out = subprocess.check_output(cmd, shell=True).decode("utf-8") |
||
15 | logger.info(out) |
||
16 | except subprocess.CalledProcessError as e: |
||
17 | raise RuntimeError( |
||
18 | f"Command {cmd} return with err {e.returncode} {e.output}" |
||
19 | ) |
||
20 | |||
21 | |||
22 | class TestTutorial: |
||
23 | @pytest.mark.parametrize( |
||
24 | "name", |
||
25 | [ |
||
26 | "custom_backbone", |
||
27 | "custom_image_label_loss", |
||
28 | "custom_parameterized_image_label_loss", |
||
29 | ], |
||
30 | ) |
||
31 | def test_registry(self, name: str): |
||
32 | cmds = [f"python examples/{name}.py"] |
||
33 | execute_commands(cmds) |
||
34 |