diff --git a/datalad_catalog/create.py b/datalad_catalog/create.py index 27132a77..e8d7da0d 100644 --- a/datalad_catalog/create.py +++ b/datalad_catalog/create.py @@ -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, diff --git a/datalad_catalog/tests/test_create.py b/datalad_catalog/tests/test_create.py index 2dfe6552..c6676bf0 100644 --- a/datalad_catalog/tests/test_create.py +++ b/datalad_catalog/tests/test_create.py @@ -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, ) @@ -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, @@ -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):