Skip to content

Commit

Permalink
Merge pull request #6690 from bpoldrack/rm-testrepos
Browse files Browse the repository at this point in the history
Discontinue usage of testrepos
  • Loading branch information
yarikoptic committed Jun 9, 2022
2 parents 8e49548 + ada1778 commit 4d53077
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 115 deletions.
17 changes: 13 additions & 4 deletions datalad/distribution/tests/test_create_sibling.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
)
from datalad.support.gitrepo import GitRepo
from datalad.support.network import urlquote
from datalad.tests.utils_testdatasets import _mk_submodule_annex
from datalad.tests.utils_pytest import (
DEFAULT_BRANCH,
DEFAULT_REMOTE,
Expand Down Expand Up @@ -67,7 +68,6 @@
slow,
swallow_logs,
with_tempfile,
with_testrepos,
with_testsui,
)
from datalad.utils import (
Expand Down Expand Up @@ -168,10 +168,16 @@ def test_invalid_call(path=None):
@slow # 26sec on travis
@skip_if_on_windows # create_sibling incompatible with win servers
@skip_ssh
@with_testrepos('.*basic.*', flavors=['local'])
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
def test_target_ssh_simple(origin=None, src_path=None, target_rootpath=None):
ca = dict(result_renderer='disabled')
test_fname = 'test-annex.dat'
orig = Dataset(origin).create(**ca)
(orig.pathobj / test_fname).write_text('some')
orig.save(**ca)

port = get_ssh_port("datalad-test")
# prepare src
source = install(
Expand Down Expand Up @@ -350,10 +356,11 @@ def process_digests_mtimes(digests, mtimes):


@slow # 53.8496s
@with_testrepos('submodule_annex', flavors=['local'])
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
@with_tempfile
def check_target_ssh_recursive(use_ssh, origin, src_path, target_path):
_mk_submodule_annex(origin, 'test-annex.dat', 'whatever')

# prepare src
source = install(src_path, source=origin, recursive=True)
Expand Down Expand Up @@ -454,10 +461,12 @@ def test_target_ssh_recursive():
skip_ssh(check_target_ssh_recursive)(True)


@with_testrepos('submodule_annex', flavors=['local'])
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
@with_tempfile
def check_target_ssh_since(use_ssh, origin, src_path, target_path):
_mk_submodule_annex(origin, 'test-annex.dat', 'whatever')

if use_ssh:
sshurl = "ssh://datalad-test" + target_path
else:
Expand Down
32 changes: 4 additions & 28 deletions datalad/distribution/tests/test_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
RemoteNotAvailableError,
)
from datalad.support.network import get_local_file_url
from datalad.tests.utils_testdatasets import (
_make_dataset_hierarchy,
_mk_submodule_annex,
)
from datalad.tests.utils_pytest import (
create_tree,
assert_false,
Expand Down Expand Up @@ -66,20 +70,6 @@
from ..dataset import Dataset


def _make_dataset_hierarchy(path):
origin = Dataset(path).create()
origin_sub1 = origin.create('sub1')
origin_sub2 = origin_sub1.create('sub2')
with open(opj(origin_sub2.path, 'file_in_annex.txt'), "w") as f:
f.write('content2')
origin_sub3 = origin_sub2.create('sub3')
with open(opj(origin_sub3.path, 'file_in_annex.txt'), "w") as f:
f.write('content3')
origin_sub4 = origin_sub3.create('sub4')
origin.save(recursive=True)
return origin, origin_sub1, origin_sub2, origin_sub3, origin_sub4


@with_tempfile
@with_tempfile
@with_tempfile
Expand Down Expand Up @@ -379,20 +369,6 @@ def test_get_recurse_dirs(o_path=None, c_path=None):
ok_(ds.repo.file_has_content('file1.txt') is True)


def _mk_submodule_annex(path, fname, fcontent):
ca = dict(result_renderer='disabled')
# a remote dataset with a subdataset underneath
origds = Dataset(path).create(**ca)
(origds.pathobj / fname).write_text(fcontent)
# naming is weird, but a legacy artifact
s1 = origds.create('subm 1', **ca)
(s1.pathobj / fname).write_text(fcontent)
s2 = origds.create('2', **ca)
(s2.pathobj / fname).write_text(fcontent)
origds.save(recursive=True, **ca)
return origds


@slow # 15.1496s
@with_tempfile(mkdir=True)
@with_tempfile(mkdir=True)
Expand Down

0 comments on commit 4d53077

Please sign in to comment.