Skip to content

Commit 750ee3c

Browse files
committed
Expand tests of .res_marg
1 parent 09025ab commit 750ee3c

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1+
from subprocess import CalledProcessError, check_call
2+
13
import pytest
24

35
from message_ix_models.tools.res_marg import main
46

57

6-
@pytest.mark.xfail(reason="Incomplete test")
78
def test_cli() -> None:
8-
# TODO Complete
9-
assert False
9+
"""Run :func:`.res_marg.main` via its command-line interface."""
10+
command = [
11+
"python",
12+
"-m",
13+
"message_ix_models.tools.res_marg",
14+
"--version=123",
15+
"model_name",
16+
"scenario_name",
17+
]
18+
19+
# Fails: the model name, scenario name, and version do not exit
20+
with pytest.raises(CalledProcessError):
21+
check_call(command)
22+
1023

24+
@pytest.mark.xfail(reason="Function does not run on the snapshot")
25+
def test_main(loaded_snapshot) -> None:
26+
"""Run :func:`.res_marg.main` on the snapshot scenarios."""
27+
scen = loaded_snapshot
1128

12-
@pytest.mark.xfail(reason="Incomplete test")
13-
def test_main() -> None:
14-
# TODO Complete
15-
main()
29+
# Function runs
30+
main(scen, None)

0 commit comments

Comments
 (0)