Push plain dataset to encrypted ria store after modification #32

Merged
christian-monch merged 3 commits from issue-31-push-to-encrypted-store into master 2022-11-07 14:17:44 +00:00
3 changed files with 37 additions and 4 deletions

View file

@ -27,7 +27,11 @@ jobs:
which git-annex which git-annex
echo which datalad echo which datalad
which datalad which datalad
datalad --version
if [ -f requirements-devel.txt ]; then pip install -r requirements-devel.txt; fi if [ -f requirements-devel.txt ]; then pip install -r requirements-devel.txt; fi
pip install datalad --upgrade
which datalad
datalad --version
- name: Lint with flake8 - name: Lint with flake8
run: | run: |
# stop the build if there are Python syntax errors or undefined names # stop the build if there are Python syntax errors or undefined names

View file

@ -277,6 +277,20 @@ def add_file_to_dataset(dataset_root: Path, file: Path, home: Path):
"HOME": str(home) "HOME": str(home)
}) })
subprocess.run(
[
"datalad",
"push",
"-d", str(dataset_root),
"--to", "entrystore",
str(file)
],
check=True,
env={
**os.environ,
"HOME": str(home)
})
return subprocess.run( return subprocess.run(
[ [
"git", "git",

View file

@ -103,8 +103,20 @@ class TestStoreData(unittest.TestCase):
with tempfile.TemporaryDirectory() as temp_dir: with tempfile.TemporaryDirectory() as temp_dir:
dataset_path = Path(temp_dir) / "dataset" dataset_path = Path(temp_dir) / "dataset"
subprocess.run(["datalad", "create", "-c", "text2git", str(dataset_path)]) subprocess.run(
subprocess.run(["datalad", "no-annex", "-d", str(dataset_path)]) ["datalad", "create", "--no-annex", str(dataset_path)],
check=True
)
sibling_path = Path(temp_dir) / "entrystore"
sibling_path.mkdir()
subprocess.run(
[
"datalad", "create-sibling", "-d", str(dataset_path), "-s",
"entrystore", str(sibling_path)
],
check=True
)
with patch("time.time") as time_mock: with patch("time.time") as time_mock:
time_mock.return_value = 0.0 time_mock.return_value = 0.0
@ -120,8 +132,11 @@ class TestStoreData(unittest.TestCase):
expected_path = dataset_path / "input/2.2/0.0.json" expected_path = dataset_path / "input/2.2/0.0.json"
with expected_path.open() as f: with expected_path.open() as f:
json_object = json.load(f) json_object_1 = json.load(f)
print(json_object) expected_sibling_path = sibling_path / "input/2.2/0.0.json"
with expected_sibling_path.open() as f:
json_object_2 = json.load(f)
assert json_object_1 == json_object_2
def test_get_int(self): def test_get_int(self):
self.assertEqual(get_int_value(".0"), 0) self.assertEqual(get_int_value(".0"), 0)