|
6 | 6 | from pathlib import Path |
7 | 7 | from textwrap import dedent |
8 | 8 |
|
9 | | -import esmvalcore |
10 | 9 | import pytest |
11 | 10 | import yaml |
12 | 11 | from esmvalcore._main import run |
13 | | -from packaging import version |
14 | 12 |
|
15 | 13 |
|
16 | 14 | def write_config_file(dirname): |
@@ -73,54 +71,6 @@ def check(result_file): |
73 | 71 | ] |
74 | 72 |
|
75 | 73 |
|
76 | | -@pytest.mark.skipif( |
77 | | - version.parse(esmvalcore.__version__) >= version.parse("2.14.0"), |
78 | | - reason="ESMValCore >= v2.14.0", |
79 | | -) |
80 | | -@pytest.mark.installation |
81 | | -@pytest.mark.parametrize("script_file", SCRIPTS) |
82 | | -def test_diagnostic_run_config_file(tmp_path, script_file): |
83 | | - local_script_file = Path(__file__).parent / script_file |
84 | | - |
85 | | - recipe_file = tmp_path / "recipe_test.yml" |
86 | | - script_file = tmp_path / script_file |
87 | | - result_file = tmp_path / "result.yml" |
88 | | - |
89 | | - shutil.copy(local_script_file, script_file) |
90 | | - |
91 | | - # Create recipe |
92 | | - recipe = dedent(f""" |
93 | | - documentation: |
94 | | - title: Test recipe |
95 | | - description: Recipe with no data. |
96 | | - authors: [andela_bouwe] |
97 | | -
|
98 | | - diagnostics: |
99 | | - diagnostic_name: |
100 | | - scripts: |
101 | | - script_name: |
102 | | - script: {script_file} |
103 | | - setting_name: {result_file} |
104 | | - """) |
105 | | - recipe_file.write_text(str(recipe)) |
106 | | - |
107 | | - config_file = write_config_file(tmp_path) |
108 | | - with arguments( |
109 | | - "esmvaltool", |
110 | | - "run", |
111 | | - "--config_file", |
112 | | - config_file, |
113 | | - str(recipe_file), |
114 | | - ): |
115 | | - run() |
116 | | - |
117 | | - check(result_file) |
118 | | - |
119 | | - |
120 | | -@pytest.mark.skipif( |
121 | | - version.parse(esmvalcore.__version__) < version.parse("2.12.0"), |
122 | | - reason="ESMValCore < v2.12.0", |
123 | | -) |
124 | 74 | @pytest.mark.installation |
125 | 75 | @pytest.mark.parametrize("script_file", SCRIPTS) |
126 | 76 | def test_diagnostic_run(tmp_path, script_file): |
|
0 commit comments