Commit 750ee3c 1 parent 09025ab commit 750ee3c Copy full SHA for 750ee3c
File tree 1 file changed +22
-7
lines changed
message_ix_models/tests/tools
1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change
1
+ from subprocess import CalledProcessError , check_call
2
+
1
3
import pytest
2
4
3
5
from message_ix_models .tools .res_marg import main
4
6
5
7
6
- @pytest .mark .xfail (reason = "Incomplete test" )
7
8
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
+
10
23
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
11
28
12
- @pytest .mark .xfail (reason = "Incomplete test" )
13
- def test_main () -> None :
14
- # TODO Complete
15
- main ()
29
+ # Function runs
30
+ main (scen , None )
You can’t perform that action at this time.
0 commit comments