Repository navigation
Conversation
Add characterization tests that replay how the three main-lineage consumers (dspace-import-clarin, dspace-rest-test, dspace-item-importer) actually call this library, plus a branch-differential CI job that runs the shared CLARIN contract against BOTH the dtq and main implementations. Only the HTTP transport is mocked; the real client builds URLs and parses responses. This PR is test + CI infrastructure only - no dspace_rest_client/ changes. The shared-surface fixes and dtq behaviour deltas that the tests would otherwise pin live in a separate, stacked PR, so this one stays scoped to validating main's usage surface and proposes nothing for main. Markers (pytest.ini): clarin - shared contract, must hold on both main and dtq dtq_only - existing dtq-only surface/behaviour, deselected on the main leg Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…uri-list body, no persisted consumer token
- remove_metadata(None, ...) test asserted it returns the client itself,
pinning a bug a sibling fix changes to None. Assert only the contract:
no request is sent and no DSO is returned.
- add_member: assert the text/uri-list body - one absolute URI under the
API ending in /epersons/{uuid}. DSpace resolves only the trailing UUID,
so this is shared contract, not dtq_only.
- consumer-smoke: checkout of the private consumer repo sets
persist-credentials: false, since the job then runs PR code.
vidiecan
force-pushed
the
test/clarin-usage-coverage
branch
from
October 7, 2026 07:26
0c7411b to
13ba16c
Compare
Rebased onto
|
| Finding | Change | Test |
|---|---|---|
test_invalid_dso_returns_self_without_request pinned a bug (remove_metadata(None, ...) returning the client); #25 changes it to None, so whichever landed second would go red |
Renamed to test_invalid_dso_sends_no_request_and_returns_no_dso: asserts no request is sent and the result is not a DSpaceObject - holds for both self and None |
passes on dtq and main legs |
add_member body was never asserted |
New shared (clarin, not dtq_only) test_posts_eperson_uri_list_and_returns_true_on_204: text/uri-list, exactly one absolute URI under the API ending in /epersons/{uuid}. DSpace resolves only the trailing UUID, so both /epersons/{uuid} (main/dtq today) and the canonical /eperson/epersons/{uuid} (#24) satisfy it |
passes on dtq and main legs |
consumer-smoke checked out private consumer repos with CONSUMER_READ_TOKEN and default persist-credentials, then ran PR code |
persist-credentials: false on that checkout |
workflow change |
Verified locally
- Full suite +
--cov-fail-under=70: 143 passed, 72% coverage. - Differential contract: dtq leg 48 passed; main leg 45 passed, 3
dtq_onlydeselected. - Python 3.8.20: 143 passed.
Deferred (not changed here)
- Chain tests in
test_clarin_usage_contract.pyare not truly chained (some feed hand-built objects instead of the previous call's result, eg.create_submit_group(type("C", (), {...})())). - Some per-method tests duplicate the chain tests (eg. the bundle-by-name lookups).
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.
Purpose
Testing infrastructure only. Adds CI + characterization tests tailor-made for
main's usage surface — how the three main-lineage consumers
(
dspace-import-clarin,dspace-rest-test,dspace-item-importer) actuallycall this library. No
dspace_rest_client/changes. Targetsdtqandproposes nothing for
main.Shared-surface fixes the tests would otherwise pin are split into a stacked PR
(
fix/clarin-shared-surface-hardening) so this one stays scoped to test/CI.What's here
test_repo_usage_contract.py: per-method andwhole-chain characterization tests, only the HTTP transport mocked (the real
client builds URLs and parses responses).
_helpers.pyCLARIN builders,pytest.inimarkers,requirements-test.txt..github/workflows/tests.yml: branch-aware triggers plus adifferential-contractjob that runs the shared CLARIN contract againstboth the
dtqand themainimplementation. The main leg checksorigin/main's client into the CI runner to test against it — read-only,nothing is written back to
main. A contract green on both is what a futuremerge would need to preserve.
Markers
clarin— shared contract, must hold on bothmainanddtq.dtq_only— existingdtq-only surface/behaviour, deselected on the main leg.Verified locally
dtqimpl): 123 pass.mainimpl): 44 pass, 3dtq_onlydeselected.