Skip to content

Commit

Permalink
test: Adjust testremote for expected failure amount
Browse files Browse the repository at this point in the history
Since Dataverse version 5.0, "storeKey when already present" of git-annex
testremote will fail, as Dataverse forbade replacing files with identical
names and checksums:
https://guides.dataverse.org/en/latest/user/dataset-management.html#duplicate-files
Because we can't exclude any test from the test suite, but wouldn't want
to disable the entire test suite, this change - rather ugly-ly - expects
the check to fail, and tests for the right amount of failures in the
test suite.

Note that it should hopefully be okay to only adjust the tests for this
altered behavior of the remote - a checkpresent prior to transfer
operations should AFAIK prevent upload/replace attempts of identical
files.
  • Loading branch information
adswa committed Aug 23, 2024
1 parent bf402b8 commit 0cdd897
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions datalad_dataverse/tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from datalad.api import clone

from datalad_next.exceptions import CommandError
from datalad_next.utils import (
on_windows,
rmtree,
Expand Down Expand Up @@ -78,9 +79,13 @@ def test_remote(dataverse_admin_credential_setup,
'drop', '--from', 'mydv', 'somefile.txt',
])
# run git-annex own testsuite
ds.repo.call_annex([
'testremote', '--fast', 'mydv',
])
# since Dataverse version 5.0, "storeKey when already present" will
# fail, as Dataverse forbids replacing files with identical names and
# checksums: https://guides.dataverse.org/en/latest/user/dataset-management.html#duplicate-files
with pytest.raises(CommandError, match='4 out of 125 tests failed'):
ds.repo.call_annex([
'testremote', '--fast', 'mydv',
])


def test_datalad_annex(dataverse_admin_credential_setup,
Expand Down

0 comments on commit 0cdd897

Please sign in to comment.