Skip to content

Commit 45027bd

Browse files
committed
update tests
1 parent 9cdc9ce commit 45027bd

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

tests/test_cli.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from . import configs_data
99

1010

11-
recipe = Path(configs_data, 'recipe.cfg')
11+
@pytest.fixture(name="workflow")
12+
def fixture_workflow():
13+
yield Path(configs_data, "workflow.cfg")
1214

1315

1416
def test_cli_has_maincli():
@@ -21,33 +23,33 @@ def test_cli_has_maincli():
2123

2224

2325
def test_ap_recipe_does_not_exist():
24-
"""Test raise error if recipe does not exist."""
26+
"""Test raise error if workflow does not exist."""
2527
with pytest.raises(SystemExit) as exit:
2628
cli.ap.parse_args('does_not_exit.cfg'.split())
2729
assert exit.type == SystemExit
2830
assert exit.value.code == 2
2931

3032

31-
def test_ap_recipe_exists():
32-
"""Test reading recipes."""
33-
cmd = cli.ap.parse_args(str(recipe).split())
34-
with open(cmd.recipe) as fin:
33+
def test_ap_workflow_exists(workflow):
34+
"""Test reading workflows."""
35+
cmd = cli.ap.parse_args(str(workflow).split())
36+
with open(cmd.workflow) as fin:
3537
fin.readlines()
3638

3739

38-
def test_ap_setup_true():
40+
def test_ap_setup_true(workflow):
3941
"""Test --setup flag."""
40-
cmd = cli.ap.parse_args(f'{recipe} --setup'.split())
42+
cmd = cli.ap.parse_args(f'{workflow} --setup'.split())
4143
assert cmd.setup_only is True
4244

4345

44-
def test_ap_setup_false():
46+
def test_ap_setup_false(workflow):
4547
"""Test setup only default."""
46-
cmd = cli.ap.parse_args(str(recipe).split())
48+
cmd = cli.ap.parse_args(str(workflow).split())
4749
assert cmd.setup_only is False
4850

4951

50-
def test_ap_version():
52+
def test_ap_version(workflow):
5153
"""Test -v version flag."""
5254
with pytest.raises(SystemExit) as exit:
5355
cli.ap.parse_args('-v'.split())
@@ -59,15 +61,15 @@ def test_ap_version():
5961
'level',
6062
("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"),
6163
)
62-
def test_ap_log_level(level):
64+
def test_ap_log_level(workflow, level):
6365
"""Test --log-level correct."""
64-
cmd = cli.ap.parse_args(f'{recipe} --log-level {level}'.split())
66+
cmd = cli.ap.parse_args(f'{workflow} --log-level {level}'.split())
6567
assert cmd.log_level == level
6668

6769

68-
def test_ap_log_level_error():
70+
def test_ap_log_level_error(workflow):
6971
"""Test --log-level error with bad input."""
7072
with pytest.raises(SystemExit) as exit:
71-
cli.ap.parse_args(f'{recipe} --log-level BAD'.split())
73+
cli.ap.parse_args(f'{workflow} --log-level BAD'.split())
7274
assert exit.type == SystemExit
7375
assert exit.value.code == 2

0 commit comments

Comments
 (0)