q63: spark/verify_report -- asserts to _check(), so -O cannot print All assertions passed on a wrong summary
This commit is contained in:
1 parent
be623cd697
commit
76224a63ca
1 file changed
+10
-3
@@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
|
||||
def _check(cond, msg="check failed"):
|
||||
"""Explicit failure path -- survives `python3 -O`, where `assert` is compiled away."""
|
||||
if not cond:
|
||||
raise SystemExit(f"FAIL: {msg}")
|
||||
|
||||
report = json.load(open('/root/.hermes/wizard-outputs/spark/validation_report.json'))
|
||||
assert report['summary']['valid_count'] == 1, "Expected 1 valid file"
|
||||
assert report['summary']['invalid_count'] == 1, "Expected 1 invalid file"
|
||||
assert report['test_passed'] == True, "Test should be marked as passed"
|
||||
_check(report['summary']['valid_count'] == 1, "Expected 1 valid file")
|
||||
_check(report['summary']['invalid_count'] == 1, "Expected 1 invalid file")
|
||||
_check(report['test_passed'] == True, "Test should be marked as passed")
|
||||
print("All assertions passed")
|
||||
exit(0)
|
||||
Reference in new issue
Block a user