Skip to content

Fix three bugs in the component tests - #46

Merged
rcannood merged 7 commits into
mainfrom
fix-component-test-checks
Aug 13, 2026
Merged

Fix three bugs in the component tests#46
rcannood merged 7 commits into
mainfrom
fix-component-test-checks

Conversation

@rcannood

Copy link
Copy Markdown
Member

These all run in viash ns test for every component in every task repo.

The required links were not checked when there were none

check_links() returned early on an empty links, before asserting that the required ones are present:

check_links({}, ["documentation", "repository"])                     # passed
check_links({"documentation": ...}, ["documentation", "repository"])  # "Link .links.repository is not defined"

So a method without any links passed, and a method with a partial links block 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 on required the way the existence check above it does. An optional output argument without a default or example never gets a value assigned, so check_format() fell over with a bare KeyError: 'value' instead of skipping it.

check_url() had no timeout

head() 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 a ConnectionError escape as a traceback.

Also

^10.\d{4,9}/ matched a doi prefix like 10X1038, since the dot was not escaped.

Tests

check_links, check_references and check_url had no tests at all; run_and_check_output had none either. Added a few for the paths touched here -- the link and output ones fail on main.

`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.
@rcannood
rcannood merged commit a73277f into main Aug 13, 2026
6 checks passed
@rcannood
rcannood deleted the fix-component-test-checks branch August 13, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant