Skip to content

Commit

Permalink
remove double yielding of results
Browse files Browse the repository at this point in the history
  • Loading branch information
jsheunis committed Jan 17, 2024
1 parent 531cfad commit b558013
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datalad_catalog/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def __call__(
# Dataset-level will inherit from catalog config in any case.
if metadata is not None:
catalog_add = Add()
yield from catalog_add(
yield catalog_add(
catalog=catalog,
metadata=metadata,
config_file=None,
Expand Down
17 changes: 11 additions & 6 deletions datalad_catalog/tests/test_create.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from datalad_catalog.create import Create
from datalad_catalog.utils import read_json_file
from datalad.tests.utils_pytest import (
assert_in_results,
)
Expand Down Expand Up @@ -53,9 +54,10 @@ def test_create_with_metadata(tmp_path, test_data):
does not yet exist and some metadata as the input args
"""
catalog_path = tmp_path / "test_catalog"
mdata_path = test_data.catalog_metadata_dataset1
res = catalog_create(
catalog=catalog_path,
metadata=test_data.catalog_metadata_dataset1,
metadata=mdata_path,
)
assert_in_results(
res,
Expand All @@ -68,12 +70,15 @@ def test_create_with_metadata(tmp_path, test_data):
for p in catalog_paths:
pth = catalog_path / p
assert pth.exists()
assert_in_results(
res,
action="catalog_add",
status="ok",
path=catalog_path,
mdata = read_json_file(mdata_path)
ds_mdata_dir = (
catalog_path
/ "metadata"
/ mdata.get("dataset_id")
/ mdata.get("dataset_version")
)
assert ds_mdata_dir.exists()
assert ds_mdata_dir.is_dir()


def test_create_at_existing_noncatalog(tmp_path):
Expand Down

0 comments on commit b558013

Please # to comment.