Return non-zero exit status when validation fails - #25
Merged
olivhoenen merged 2 commits intoOct 1, 2026
Merged
olivhoenen merged 2 commits into
olivhoenen merged 2 commits into
Conversation
olivhoenen
requested changes
Oct 1, 2026
|
|
||
| assert completed.returncode == 1 | ||
| assert completed.stdout.splitlines()[-1] == str(uri) | ||
| assert "FAILED validation." in completed.stdout |
Collaborator
There was a problem hiding this comment.
Finding from Claude:
The check assert "FAILED validation." in completed.stdout depends on how long the temp path is. The "URI has FAILED validation." line is printed by rich's RichHandler. When stdout isn't a terminal, rich wraps lines at 80 columns by default, and it can break between "FAILED" and "validation.". That happens or not depending on how long the pytest temp path is.
It can therefore fail on CI, under -n=auto (whose worker subfolders make the path longer), or for users with longer usernames. Possible fixes:
- drop this check;
- or match on a normalised string, for example " ".join(stdout.split()).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22.
The CLI currently reports failed validation while returning exit status 0, so CI systems treat rejected datasets as successful checks.
Return an explicit status from
main()and propagate it throughsys.exit()at both CLI entry paths:The status is computed across every executed
ValidateCommand. Per-URI and summary reports are still generated before returning, and the existing final stdout line listing failed URIs is unchanged. Document the exit-status contract in the README.Add regression coverage for successful validation, mixed multi-URI validation, report generation on failure, failed-URI output, argparse errors, and the real
python -m imas_validatorentry point with an invalid netCDF dataset.Validation on the rebased current head: