@@ -65,32 +65,8 @@ def branch_type(control_path, target_branch):
65
65
66
66
67
67
@pytest .mark .config
68
- class TestConfig :
69
- """General configuration tests"""
70
-
71
- @pytest .mark .parametrize ("field" , ["project" , "shortpath" ])
72
- def test_field_is_not_defined (self , config , field ):
73
- assert (
74
- field not in config
75
- ), f"{ field } should not be defined: '{ field } : { config [field ]} '"
76
-
77
- def test_absolute_input_paths (self , config ):
78
- for path in insist_array (config .get ("input" , [])):
79
- assert Path (path ).is_absolute (), f"Input path should be absolute: { path } "
80
-
81
- def test_absolute_submodel_input_paths (self , config ):
82
- for model in config .get ("submodels" , []):
83
- for path in insist_array (model .get ("input" , [])):
84
- assert Path (path ).is_absolute (), (
85
- f"Input path for { model ['name' ]} submodel should be "
86
- + f" absolute: { path } "
87
- )
88
-
89
- def test_no_storage_qsub_flags (self , config ):
90
- qsub_flags = config .get ("qsub_flags" , "" )
91
- assert (
92
- "storage" not in qsub_flags
93
- ), "Storage flags defined in qsub_flags will be silently ignored"
68
+ class TestRelConfig :
69
+ """General configuration tests for release branches"""
94
70
95
71
def test_runlog_is_on (self , config ):
96
72
runlog_config = config .get ("runlog" , {})
@@ -110,18 +86,6 @@ def test_restart_freq_is_date_based(self, config):
110
86
"Restart frequency should be date-based: " + f"'restart_freq: { frequency } '"
111
87
)
112
88
113
- def test_sync_is_not_enabled (self , config ):
114
- if "sync" in config and "enable" in config ["sync" ]:
115
- assert not config ["sync" ][
116
- "enable"
117
- ], "Sync to remote archive should not be enabled"
118
-
119
- def test_sync_path_is_not_set (self , config ):
120
- if "sync" in config :
121
- assert not (
122
- "path" in config ["sync" ] and config ["sync" ]["path" ] is not None
123
- ), "Sync path to remote archive should not be set"
124
-
125
89
def test_manifest_reproduce_exe_is_on (self , config ):
126
90
manifest_reproduce = config .get ("manifest" , {}).get ("reproduce" , {})
127
91
assert "exe" in manifest_reproduce and manifest_reproduce ["exe" ], (
@@ -137,13 +101,6 @@ def test_metadata_is_enabled(self, config):
137
101
+ "branch and UUIDs are not used in the name used for archival."
138
102
)
139
103
140
- def test_experiment_name_is_not_defined (self , config ):
141
- assert "experiment" not in config , (
142
- f"experiment: { config ['experiment' ]} should not set, "
143
- + "as this over-rides the experiment name used for archival. "
144
- + "If set, branching in payu would not work."
145
- )
146
-
147
104
def test_no_scripts_in_top_level_directory (self , control_path ):
148
105
exts = {".py" , ".sh" }
149
106
scripts = [p for p in control_path .iterdir () if p .suffix in exts ]
@@ -178,7 +135,6 @@ def test_validate_metadata(self, metadata):
178
135
"keywords" ,
179
136
"nominal_resolution" ,
180
137
"version" ,
181
- "reference" ,
182
138
"url" ,
183
139
"model" ,
184
140
"realm" ,
@@ -187,17 +143,41 @@ def test_validate_metadata(self, metadata):
187
143
def test_metadata_contains_fields (self , field , metadata ):
188
144
assert field in metadata , f"{ field } field shoud be defined in metadata"
189
145
190
- def test_metadata_does_contain_UUID (self , metadata ):
191
- assert "experiment_uuid" not in metadata , (
192
- "`experiment_uuid` should not be defined in metadata, "
193
- + "as this is an configuration rather than an experiment. "
194
- )
195
-
196
146
def test_metadata_license (self , metadata ):
197
147
assert (
198
148
"license" in metadata and metadata ["license" ] == LICENSE
199
149
), f"The license should be set to { LICENSE } "
200
150
151
+
152
+ @pytest .mark .config
153
+ @pytest .mark .dev_config
154
+ class TestConfig :
155
+ """General configuration tests"""
156
+
157
+ @pytest .mark .parametrize ("field" , ["project" , "shortpath" ])
158
+ def test_field_is_not_defined (self , config , field ):
159
+ assert (
160
+ field not in config
161
+ ), f"{ field } should not be defined: '{ field } : { config [field ]} '"
162
+
163
+ def test_absolute_input_paths (self , config ):
164
+ for path in insist_array (config .get ("input" , [])):
165
+ assert Path (path ).is_absolute (), f"Input path should be absolute: { path } "
166
+
167
+ def test_absolute_submodel_input_paths (self , config ):
168
+ for model in config .get ("submodels" , []):
169
+ for path in insist_array (model .get ("input" , [])):
170
+ assert Path (path ).is_absolute (), (
171
+ f"Input path for { model ['name' ]} submodel should be "
172
+ + f" absolute: { path } "
173
+ )
174
+
175
+ def test_no_storage_qsub_flags (self , config ):
176
+ qsub_flags = config .get ("qsub_flags" , "" )
177
+ assert (
178
+ "storage" not in qsub_flags
179
+ ), "Storage flags defined in qsub_flags will be silently ignored"
180
+
201
181
def test_license_file (self , control_path ):
202
182
license_path = control_path / "LICENSE"
203
183
assert license_path .exists (), (
@@ -232,6 +212,31 @@ def test_model_module_path_is_defined(self, branch_type, config):
232
212
"The target branch is a dev version and doesn't require a stable module location"
233
213
)
234
214
215
+ def test_metadata_does_not_contain_UUID (self , metadata ):
216
+ assert "experiment_uuid" not in metadata , (
217
+ "`experiment_uuid` should not be defined in metadata, "
218
+ + "as this is an configuration rather than an experiment. "
219
+ )
220
+
221
+ def test_sync_is_not_enabled (self , config ):
222
+ if "sync" in config and "enable" in config ["sync" ]:
223
+ assert not config ["sync" ][
224
+ "enable"
225
+ ], "Sync to remote archive should not be enabled"
226
+
227
+ def test_sync_path_is_not_set (self , config ):
228
+ if "sync" in config :
229
+ assert not (
230
+ "path" in config ["sync" ] and config ["sync" ]["path" ] is not None
231
+ ), "Sync path to remote archive should not be set"
232
+
233
+ def test_experiment_name_is_not_defined (self , config ):
234
+ assert "experiment" not in config , (
235
+ f"experiment: { config ['experiment' ]} should not set, "
236
+ + "as this over-rides the experiment name used for archival. "
237
+ + "If set, branching in payu would not work."
238
+ )
239
+
235
240
236
241
def read_exe_manifest_fullpaths (control_path : Path ):
237
242
"""Return the full paths to the executables in the executable manifest file"""
0 commit comments