Fix three bugs in the component tests - #46
Merged
Conversation
`check_links()` returned early on an empty `links`, before asserting that the required ones are present. A method without any links passed the check, while a method with only a `documentation` link was correctly told that `.links.repository` is missing.
The format validation loop did not filter on `required` the way the existence check above it does, so an optional output without a default or example -- which never gets a value assigned -- crashed the component test with a bare `KeyError: 'value'`.
Every component test checks the links and dois in its config, and `head()` without a timeout waits forever on an unresponsive host. A request that fails outright now reports the link as unreachable instead of letting a `ConnectionError` escape.
`^10.\d{4,9}/` also matched a prefix like `10X1038`.
The new `check_url()` test needs it. `check_url()` imports it inside the function, so it stays out of the runtime dependencies of the package.
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.
These all run in
viash ns testfor every component in every task repo.The required links were not checked when there were none
check_links()returned early on an emptylinks, before asserting that the required ones are present:So a method without any links passed, and a method with a partial
linksblock failed -- the wrong way around, since methods are exactly where those links are mandatory.An optional output crashed the test
The format validation loop in
check_output_files()does not filter onrequiredthe way the existence check above it does. An optional output argument without a default or example never gets a value assigned, socheck_format()fell over with a bareKeyError: 'value'instead of skipping it.check_url()had no timeouthead()without a timeout waits forever on an unresponsive host, and every component test checks all the links and dois in its config. It now uses a 30 second timeout, and a request that fails outright reports the link as unreachable instead of letting aConnectionErrorescape as a traceback.Also
^10.\d{4,9}/matched a doi prefix like10X1038, since the dot was not escaped.Tests
check_links,check_referencesandcheck_urlhad no tests at all;run_and_check_outputhad none either. Added a few for the paths touched here -- the link and output ones fail onmain.