Skip to content

Commit

Permalink
TST: Adjust test for new error destination
Browse files Browse the repository at this point in the history
  • Loading branch information
mih committed Dec 10, 2020
1 parent 5093fef commit 794dac2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion datalad/customremotes/tests/test_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
assert_is_instance,
assert_not_equal,
assert_not_in,
assert_raises,
assert_true,
chpwd,
eq_,
Expand All @@ -53,6 +54,7 @@
StdOutErrCapture,
WitlessRunner,
)
from datalad.support.exceptions import CommandError
from ...utils import (
_path_,
unlink,
Expand Down Expand Up @@ -126,7 +128,7 @@ def test_basic_scenario(d, d2):
assert_true(annex.file_has_content(fn_extracted))

annex.rm_url(fn_extracted, file_url)
assert_false(annex.drop(fn_extracted)['success'])
assert_raises(CommandError, annex.drop, fn_extracted)

annex.add_url_to_file(fn_extracted, file_url)
annex.drop(fn_extracted)
Expand Down
3 changes: 2 additions & 1 deletion datalad/customremotes/tests/test_datalad.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def check_basic_scenario(url, d):
with swallow_outputs() as cmo, swallow_logs() as cml:
with assert_raises(CommandError) as cme:
annex.add_urls([url + '_bogus'])
assert_in('addurl: 1 failed', cme.stderr)
# assert_equal(cml.out, '')
err, out = cmo.err, cmo.out
assert_equal(out, '')
assert_in('addurl: 1 failed', err)
assert_equal(err, '')
# and there should be nothing more


Expand Down
19 changes: 11 additions & 8 deletions datalad/interface/tests/test_add_archive_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
)

from datalad.support.annexrepo import AnnexRepo
from datalad.support.exceptions import FileNotInRepositoryError
from datalad.support.exceptions import (
CommandError,
FileNotInRepositoryError,
)
from datalad.utils import (
chpwd,
find_files,
Expand Down Expand Up @@ -309,13 +312,13 @@ def d2_basic_checks():
# verify that we can't drop a file if archive key was dropped and online archive was removed or changed size! ;)
repo.get(key_1tar, key=True)
unlink(opj(path_orig, '1.tar.gz'))
res = repo.drop(key_1tar, key=True)
assert_equal(res['success'], False)

assert_result_values_cond(
[res], 'note',
lambda x: '(Use --force to override this check, or adjust numcopies.)' in x
)
with assert_raises(CommandError) as e:
repo.drop(key_1tar, key=True)
assert_equal(e.kwargs['stdout_json'][0]['success'], False)
assert_result_values_cond(
e.kwargs['stdout_json'], 'note',
lambda x: '(Use --force to override this check, or adjust numcopies.)' in x
)
assert exists(opj(repo.path, repo.get_contentlocation(key_1tar)))


Expand Down

0 comments on commit 794dac2

Please sign in to comment.