Repository navigation
fix(test): make Test_scitag.py independent of the live scitags.org API - #9003
Merged
Merged
Conversation
get_scitag() fetches https://scitags.org/api.json, but the unit tests asserted against VO/activity ids hardcoded from a past snapshot of that API. scitags.org has since evolved (e.g. atlas 'Analysis Output' moved from activityId 18 to 12, 'Debug' no longer matches), and the fetch can also fail outright in CI, so the tests were flaky. Mock the network call with a static fixture, clear the module-level caches around each test, and add coverage for the network-failure fallback and the fetch-once caching behaviour.
Merged
1 task done
aldbr
reviewed
Dec 4, 2026
aldbr
left a comment
Contributor
There was a problem hiding this comment.
LGTM, but how do we now make sure we are not drifting apart from https://scitags.org/api.json?
Contributor
Author
|
The schema should not be changing. |
Contributor
|
Well, but as we can see it just changed 😅 |
Contributor
Author
|
The schema did not change, the value in it might |
aldbr
approved these changes
Dec 4, 2026
Contributor
|
Oh indeed I see, then LGTM |
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.
BEGIN_PR_BODY
Description
The scitag unit tests were failing in CI (e.g. this run) because
get_scitag()resolves VO/activity ids from the live https://scitags.org/api.json, while the tests asserted against ids hardcoded from a past snapshot of that API:Analysis Outputis nowactivityId=12upstream (test expected 18) →assert 140 == 146Debugno longer matches (test expected 9) → falls back to default →assert 129 == 137This PR makes the tests hermetic:
requests.getis mocked with a static fixture mirroring theapi.jsonstructure, so results are deterministic._scitag_cache,_scitag_json_cache) are cleared around each test so cached real-network results cannot leak into the tests.The suite now runs in <1s with no network access.
Local tests (with ANA eras)
END_PR_BODY