|
15 | 15 | log = logging.getLogger(__name__)
|
16 | 16 |
|
17 | 17 |
|
18 |
| -def _check_version_content_format(snap_content, test_name, snap_file): |
19 |
| - """ |
20 |
| - Check if version content uses actual YAML data vs hash format. |
21 |
| -
|
22 |
| - Args: |
23 |
| - snap_content: Parsed JSON snapshot content |
24 |
| - test_name: Name of the test being checked |
25 |
| - snap_file: Path to snapshot file (for error reporting) |
26 |
| -
|
27 |
| - Returns: |
28 |
| - Tuple for passed test if valid, None if invalid or no version data found |
29 |
| - """ |
30 |
| - # Check if this test contains version data and if it's in hash format |
31 |
| - if _contains_version_hash(snap_content[test_name]): |
32 |
| - return None # Invalid - contains hash format |
33 |
| - |
34 |
| - # Valid - either contains actual content or no version hash detected |
35 |
| - return ( |
36 |
| - "test_snap_version_content", |
37 |
| - "version information contains actual content instead of hash", |
38 |
| - snap_file, |
39 |
| - ) |
40 |
| - |
41 |
| - |
42 | 18 | def _contains_version_hash(test_content):
|
43 | 19 | """
|
44 | 20 | Check if test content contains version information in hash format.
|
@@ -215,38 +191,43 @@ def module_tests(_, module: NFCoreComponent, allow_missing: bool = False):
|
215 | 191 | snap_file,
|
216 | 192 | )
|
217 | 193 | )
|
218 |
| - if "versions" in str(snap_content[test_name]) or "versions" in str(snap_content.keys()): |
219 |
| - module.passed.append( |
220 |
| - ( |
221 |
| - "test_snap_versions", |
222 |
| - "versions found in snapshot file", |
223 |
| - snap_file, |
| 194 | + if "versions" in str(snap_content[test_name]) or "versions" in str(snap_content.keys()): |
| 195 | + module.passed.append( |
| 196 | + ( |
| 197 | + "test_snap_versions", |
| 198 | + "versions found in snapshot file", |
| 199 | + snap_file, |
| 200 | + ) |
224 | 201 | )
|
225 |
| - ) |
226 |
| - # Check if version content is actual content vs MD5/SHA hash |
227 |
| - # Related to: https://github.com/nf-core/modules/issues/6505 |
228 |
| - # Ensures version snapshots contain actual content instead of hash values |
229 |
| - version_check_result = _check_version_content_format(snap_content, test_name, snap_file) |
230 |
| - if version_check_result: |
231 |
| - module.passed.append(version_check_result) |
232 |
| - else: |
233 |
| - # Only add failure if we found hash patterns |
| 202 | + # Check if version content is actual content vs MD5/SHA hash |
| 203 | + # Related to: https://github.com/nf-core/modules/issues/6505 |
| 204 | + # Ensures version snapshots contain actual content instead of hash values |
234 | 205 | if _contains_version_hash(snap_content[test_name]):
|
| 206 | + # Invalid - contains hash format |
235 | 207 | module.failed.append(
|
236 | 208 | (
|
237 | 209 | "test_snap_version_content",
|
238 | 210 | "Version information should contain actual YAML content (e.g., {'tool': {'version': '1.0'}}), not hash format like 'versions.yml:md5,hash'",
|
239 | 211 | snap_file,
|
240 | 212 | )
|
241 | 213 | )
|
242 |
| - else: |
243 |
| - module.failed.append( |
244 |
| - ( |
245 |
| - "test_snap_versions", |
246 |
| - "versions not found in snapshot file", |
247 |
| - snap_file, |
| 214 | + else: |
| 215 | + # Valid - either contains actual content or no version hash detected |
| 216 | + module.passed.append( |
| 217 | + ( |
| 218 | + "test_snap_version_content", |
| 219 | + "version information contains actual content instead of hash", |
| 220 | + snap_file, |
| 221 | + ) |
| 222 | + ) |
| 223 | + else: |
| 224 | + module.failed.append( |
| 225 | + ( |
| 226 | + "test_snap_versions", |
| 227 | + "versions not found in snapshot file", |
| 228 | + snap_file, |
| 229 | + ) |
248 | 230 | )
|
249 |
| - ) |
250 | 231 | except json.decoder.JSONDecodeError as e:
|
251 | 232 | module.failed.append(
|
252 | 233 | (
|
|
0 commit comments