Skip to content

Commit

Permalink
fix(tests): ensure that datalad_next is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-monch committed Jun 11, 2024
1 parent 37f71da commit 56444c8
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions datalad_next/patches/tests/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ def test_nested_pushclone_cycle_allplatforms(origpath=None, storepath=None, clon
from datalad.cmd import WitlessRunner as Runner
run = Runner().run

os.environ['DATALAD_EXTENSIONS_LOAD'] = 'next'

# create original nested dataset
with chpwd(origpath):
run(['datalad', 'create', 'super'])
run(['datalad', 'create', '-d', 'super', str(Path('super', 'sub'))])
run(['datalad', 'create', 'super'], env=os.environ)
run(
[
'datalad', 'create', '-d', 'super',
str(Path('super', 'sub'))
],
env=os.environ
)

# verify essential linkage properties
orig_super = Dataset(Path(origpath, 'super'))
Expand All @@ -69,7 +77,7 @@ def test_nested_pushclone_cycle_allplatforms(origpath=None, storepath=None, clon
(orig_super.pathobj / 'file1.txt').write_text('some1')
(orig_sub.pathobj / 'file2.txt').write_text('some1')
with chpwd(orig_super.path):
run(['datalad', 'save', '--recursive'])
run(['datalad', 'save', '--recursive'], env=os.environ)

# TODO not yet reported clean with adjusted branches
#assert_repo_status(orig_super.path)
Expand All @@ -93,9 +101,17 @@ def test_nested_pushclone_cycle_allplatforms(origpath=None, storepath=None, clon
# (i.e. no impact of an annex-init of any kind)
store_url = 'ria+' + get_local_file_url(storepath)
with chpwd(orig_super.path):
run(['datalad', 'create-sibling-ria', '--recursive',
'-s', 'store', store_url, '--new-store-ok'])
run(['datalad', 'push', '--recursive', '--to', 'store'])
run(
[
'datalad', 'create-sibling-ria', '--recursive',
'-s', 'store', store_url, '--new-store-ok'
],
env=os.environ
)
run(
['datalad', 'push', '--recursive', '--to', 'store'],
env=os.environ
)

# we are using the 'store' sibling's URL, which should be a plain path
store_super = AnnexRepo(orig_super.siblings(name='store')[0]['url'], init=False)
Expand All @@ -109,8 +125,14 @@ def test_nested_pushclone_cycle_allplatforms(origpath=None, storepath=None, clon
# and reobtain from a store
cloneurl = 'ria+' + get_local_file_url(str(storepath), compatibility='git')
with chpwd(clonepath):
run(['datalad', 'clone', cloneurl + '#' + orig_super.id, 'super'])
run(['datalad', '-C', 'super', 'get', '--recursive', '.'])
run(
['datalad', 'clone', cloneurl + '#' + orig_super.id, 'super'],
env=os.environ
)
run(
['datalad', '-C', 'super', 'get', '--recursive', '.'],
env=os.environ

Check warning on line 134 in datalad_next/patches/tests/test_push.py

View check run for this annotation

Codecov / codecov/patch

datalad_next/patches/tests/test_push.py#L134

Added line #L134 was not covered by tests
)

# verify that nothing has changed as a result of a push/clone cycle
clone_super = Dataset(Path(clonepath, 'super'))
Expand Down

0 comments on commit 56444c8

Please sign in to comment.