dtoolcore 3.18.3__tar.gz → 3.19.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/.github/workflows/test.yml +4 -4
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/CHANGELOG.rst +6 -2
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/PKG-INFO +1 -1
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/__init__.py +29 -3
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/storagebroker.py +12 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/version.py +2 -2
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/PKG-INFO +1 -1
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_annotation_functional.py +20 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_copy_dataset.py +6 -6
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_create_dataset_helpers_functional.py +35 -3
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_creation_and_reading_functional.py +10 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_frozen_at_when_copying_dataset.py +2 -2
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_update_dataset_name.py +1 -1
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/.github/dependabot.yml +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/.github/workflows/publish.yml +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/.gitignore +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/.travis.yml +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/LICENSE.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/MANIFEST.in +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/README.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/appveyor.yml +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/.gitignore +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/Makefile +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/make.bat +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/CHANGELOG.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/LICENSE.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/README.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api/compare.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api/dtoolcore.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api/filehasher.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api/storagebroker.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api/utils.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/api.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/conf.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/descriptive.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/docs/source/index.rst +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/compare.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/filehasher.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore/utils.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/SOURCES.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/dependency_links.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/entry_points.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/requires.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/dtoolcore.egg-info/top_level.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/icons/22x22/dtool_logo.png +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/pyproject.toml +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/requirements.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/setup.cfg +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/__init__.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/actually_a_png.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/actually_a_text_file.jpg +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/another_file.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/empty_file +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/random_bytes +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/real_text_file.txt +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/data/tiny.png +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_BaseDataSet_uri_property.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_DiskStorageBroker.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_abspath_uri.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_compare_module.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_dtool_list_overlays_when_dir_missing.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_dtoolcore_package.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_filehasher_api.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_generate_admin_metadata.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_iter_datasets_in_base_uri.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_overlays_functional.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_self_description.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_tags_functional.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_timestamp.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_uri_property_when_using_relpath.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_uri_sanitisation.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tests/test_utils_module.py +0 -0
- {dtoolcore-3.18.3 → dtoolcore-3.19.0}/tox.ini +0 -0
|
@@ -15,14 +15,14 @@ jobs:
|
|
|
15
15
|
|
|
16
16
|
strategy:
|
|
17
17
|
matrix:
|
|
18
|
-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
|
18
|
+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
|
|
19
19
|
|
|
20
20
|
steps:
|
|
21
21
|
- name: Git checkout
|
|
22
|
-
uses: actions/checkout@
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
23
|
|
|
24
24
|
- name: Set up python3 ${{ matrix.python-version }}
|
|
25
|
-
uses: actions/setup-python@
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
26
|
with:
|
|
27
27
|
python-version: ${{ matrix.python-version }}
|
|
28
28
|
|
|
@@ -44,4 +44,4 @@ jobs:
|
|
|
44
44
|
# stop the build if there are Python syntax errors or undefined names
|
|
45
45
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
46
46
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
47
|
-
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics
|
|
47
|
+
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics
|
|
@@ -5,17 +5,21 @@ This project uses `semantic versioning <http://semver.org/>`_.
|
|
|
5
5
|
This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
[
|
|
9
|
-
|
|
8
|
+
[3.19.0] - 2024-12-16
|
|
9
|
+
---------------------
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Added
|
|
13
13
|
^^^^^
|
|
14
14
|
|
|
15
|
+
- ``delete_annotation`` method on ``Dataset`` class
|
|
16
|
+
- Test with Python 3.13 in CI workflow
|
|
15
17
|
|
|
16
18
|
Changed
|
|
17
19
|
^^^^^^^
|
|
18
20
|
|
|
21
|
+
- public ``admin_metadata`` property exposes private ``_admin_metadata`` attribute of ``Dataset``
|
|
22
|
+
- ``pkg_resources`` has been deprecated with Python 3.12. Replaced use of ``pkg_resources.iter_entry_points`` with ``importlib.metadata.entry_points`` for >= Python 3.8
|
|
19
23
|
|
|
20
24
|
Deprecated
|
|
21
25
|
^^^^^^^^^^
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
+
import sys
|
|
6
7
|
|
|
7
8
|
import datetime
|
|
8
9
|
import logging
|
|
@@ -11,7 +12,6 @@ import shutil
|
|
|
11
12
|
import tempfile
|
|
12
13
|
import uuid
|
|
13
14
|
|
|
14
|
-
from pkg_resources import iter_entry_points
|
|
15
15
|
from collections import defaultdict
|
|
16
16
|
|
|
17
17
|
import dtoolcore.utils
|
|
@@ -34,7 +34,7 @@ except PackageNotFoundError:
|
|
|
34
34
|
# if that fails, check for static version file written by setuptools_scm
|
|
35
35
|
try:
|
|
36
36
|
from .version import version as __version__
|
|
37
|
-
logger.debug("Determined version %s from autogenerated
|
|
37
|
+
logger.debug("Determined version %s from autogenerated dtoolcore/version.py", __version__)
|
|
38
38
|
except Exception as e:
|
|
39
39
|
logger.debug("All efforts to determine version failed: %s", e)
|
|
40
40
|
__version__ = None
|
|
@@ -59,7 +59,19 @@ def _generate_storage_broker_lookup():
|
|
|
59
59
|
"""Return dictionary of available storage brokers."""
|
|
60
60
|
logger.debug("In _generate_storage_broker_lookup...")
|
|
61
61
|
storage_broker_lookup = dict()
|
|
62
|
-
|
|
62
|
+
|
|
63
|
+
if sys.version_info >= (3, 8):
|
|
64
|
+
from importlib.metadata import entry_points
|
|
65
|
+
eps = entry_points()
|
|
66
|
+
if sys.version_info >= (3, 10):
|
|
67
|
+
entrypoints = eps.select(group="dtool.storage_brokers")
|
|
68
|
+
else:
|
|
69
|
+
entrypoints = eps.get("dtool.storage_brokers", [])
|
|
70
|
+
else:
|
|
71
|
+
from pkg_resources import iter_entry_points
|
|
72
|
+
entrypoints = iter_entry_points("dtool.storage_brokers")
|
|
73
|
+
|
|
74
|
+
for entrypoint in entrypoints:
|
|
63
75
|
StorageBroker = entrypoint.load()
|
|
64
76
|
key = StorageBroker.key
|
|
65
77
|
logger.debug("_gnerate_stroage_broker_lookup.key: {}".format(key))
|
|
@@ -448,6 +460,11 @@ class _BaseDataSet(object):
|
|
|
448
460
|
"""Return the name of the dataset."""
|
|
449
461
|
return self._admin_metadata['name']
|
|
450
462
|
|
|
463
|
+
@property
|
|
464
|
+
def admin_metadata(self):
|
|
465
|
+
"""Return admin metadata of the dataset."""
|
|
466
|
+
return self._admin_metadata
|
|
467
|
+
|
|
451
468
|
def update_name(self, new_name):
|
|
452
469
|
"""Update the name of the proto dataset.
|
|
453
470
|
|
|
@@ -594,6 +611,15 @@ class _BaseDataSet(object):
|
|
|
594
611
|
logger.debug("List annotation names {}".format(self))
|
|
595
612
|
return sorted(self._storage_broker.list_annotation_names())
|
|
596
613
|
|
|
614
|
+
def delete_annotation(self, annotation_name):
|
|
615
|
+
"""Delete an annotation from a dataset.
|
|
616
|
+
|
|
617
|
+
:param annotation_name: name of annotation
|
|
618
|
+
:raises: DtoolCoreInvalidNameError if the annotation name
|
|
619
|
+
is invalid
|
|
620
|
+
"""
|
|
621
|
+
self._storage_broker.delete_annotation(annotation_name)
|
|
622
|
+
|
|
597
623
|
def put_tag(self, tag):
|
|
598
624
|
"""Annotate the dataset with a tag.
|
|
599
625
|
|
|
@@ -264,6 +264,7 @@ class BaseStorageBroker(object):
|
|
|
264
264
|
def get_annotation(self, annotation_name):
|
|
265
265
|
"""Return value of the annotation associated with the key.
|
|
266
266
|
|
|
267
|
+
:param annotation_name: annotation name
|
|
267
268
|
:returns: annotation (string, int, float, bool)
|
|
268
269
|
:raises: DtoolCoreAnnotationKeyError if the annotation does not exist
|
|
269
270
|
"""
|
|
@@ -327,6 +328,8 @@ class BaseStorageBroker(object):
|
|
|
327
328
|
|
|
328
329
|
def put_tag(self, tag):
|
|
329
330
|
"""Annotate the dataset with a tag.
|
|
331
|
+
|
|
332
|
+
:param tag: tag
|
|
330
333
|
"""
|
|
331
334
|
logger.debug("Putting tag: {} {}".format(tag, self))
|
|
332
335
|
key = self.get_tag_key(tag)
|
|
@@ -341,6 +344,15 @@ class BaseStorageBroker(object):
|
|
|
341
344
|
key = self.get_tag_key(tag)
|
|
342
345
|
self.delete_key(key)
|
|
343
346
|
|
|
347
|
+
def delete_annotation(self, annotation_name):
|
|
348
|
+
"""Delete an annotation from a dataset.
|
|
349
|
+
|
|
350
|
+
:param annotation_name: annotation name
|
|
351
|
+
"""
|
|
352
|
+
logger.debug("Deleting annotation: {} {}".format(annotation_name, self))
|
|
353
|
+
key = self.get_annotation_key(annotation_name)
|
|
354
|
+
self.delete_key(key)
|
|
355
|
+
|
|
344
356
|
def get_relpath(self, handle):
|
|
345
357
|
"""Return the relative path."""
|
|
346
358
|
return handle
|
|
@@ -54,6 +54,18 @@ def test_annotation_functional(tmp_dir_fixture): # NOQA
|
|
|
54
54
|
|
|
55
55
|
assert proto_dataset.list_annotation_names() == ["project"]
|
|
56
56
|
|
|
57
|
+
# Test deleting annotations on proto dataset
|
|
58
|
+
proto_dataset.put_annotation(annotation_name="stars", annotation=1)
|
|
59
|
+
assert proto_dataset.get_annotation("stars") == 1
|
|
60
|
+
assert proto_dataset.list_annotation_names() == ["project", "stars"]
|
|
61
|
+
|
|
62
|
+
proto_dataset.delete_annotation("stars")
|
|
63
|
+
|
|
64
|
+
with pytest.raises(DtoolCoreKeyError):
|
|
65
|
+
proto_dataset.get_annotation(annotation_name="stars")
|
|
66
|
+
|
|
67
|
+
assert proto_dataset.list_annotation_names() == ["project"]
|
|
68
|
+
|
|
57
69
|
# Freeze the dataset
|
|
58
70
|
proto_dataset.put_readme("")
|
|
59
71
|
proto_dataset.freeze()
|
|
@@ -91,3 +103,11 @@ def test_annotation_functional(tmp_dir_fixture): # NOQA
|
|
|
91
103
|
assert copy_dataset.list_annotation_names() == ["project", "stars"]
|
|
92
104
|
assert copy_dataset.get_annotation("stars") == 5
|
|
93
105
|
assert copy_dataset.get_annotation("project") == "food-sustainability"
|
|
106
|
+
|
|
107
|
+
# Test deleting annotation on frozen dataset
|
|
108
|
+
dataset.delete_annotation("stars")
|
|
109
|
+
|
|
110
|
+
with pytest.raises(DtoolCoreKeyError):
|
|
111
|
+
dataset.get_annotation(annotation_name="stars")
|
|
112
|
+
|
|
113
|
+
assert dataset.list_annotation_names() == ["project"]
|
|
@@ -51,8 +51,8 @@ def test_copy(tmp_uri_fixture): # NOQA
|
|
|
51
51
|
src_ds = dtoolcore.DataSet.from_uri(src_uri)
|
|
52
52
|
dest_ds = dtoolcore.DataSet.from_uri(dest_uri)
|
|
53
53
|
|
|
54
|
-
for key, value in src_ds.
|
|
55
|
-
assert dest_ds.
|
|
54
|
+
for key, value in src_ds.admin_metadata.items():
|
|
55
|
+
assert dest_ds.admin_metadata[key] == value
|
|
56
56
|
|
|
57
57
|
assert src_ds.identifiers == dest_ds.identifiers
|
|
58
58
|
for i in src_ds.identifiers:
|
|
@@ -127,8 +127,8 @@ def test_copy_resume(tmp_uri_fixture): # NOQA
|
|
|
127
127
|
src_ds = dtoolcore.DataSet.from_uri(src_uri)
|
|
128
128
|
dest_ds = dtoolcore.DataSet.from_uri(dest_uri)
|
|
129
129
|
|
|
130
|
-
for key, value in src_ds.
|
|
131
|
-
assert dest_ds.
|
|
130
|
+
for key, value in src_ds.admin_metadata.items():
|
|
131
|
+
assert dest_ds.admin_metadata[key] == value
|
|
132
132
|
|
|
133
133
|
assert src_ds.identifiers == dest_ds.identifiers
|
|
134
134
|
for i in src_ds.identifiers:
|
|
@@ -197,8 +197,8 @@ def test_copy_resume_fixes_broken_files(tmp_uri_fixture): # NOQA
|
|
|
197
197
|
src_ds = dtoolcore.DataSet.from_uri(src_uri)
|
|
198
198
|
dest_ds = dtoolcore.DataSet.from_uri(dest_uri)
|
|
199
199
|
|
|
200
|
-
for key, value in src_ds.
|
|
201
|
-
assert dest_ds.
|
|
200
|
+
for key, value in src_ds.admin_metadata.items():
|
|
201
|
+
assert dest_ds.admin_metadata[key] == value
|
|
202
202
|
|
|
203
203
|
assert src_ds.identifiers == dest_ds.identifiers
|
|
204
204
|
for i in src_ds.identifiers:
|
|
@@ -38,7 +38,14 @@ def test_create_proto_dataset(tmp_dir_fixture): # NOQA
|
|
|
38
38
|
creator_username=creator_username
|
|
39
39
|
)
|
|
40
40
|
assert isinstance(proto_dataset, dtoolcore.ProtoDataSet)
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
assert "created_at" in proto_dataset.admin_metadata
|
|
43
|
+
assert "frozen_at" not in proto_dataset.admin_metadata
|
|
44
|
+
assert proto_dataset.admin_metadata["dtoolcore_version"] == dtoolcore.__version__ # NOQA
|
|
45
|
+
assert proto_dataset.admin_metadata["creator_username"] == creator_username # NOQA
|
|
46
|
+
assert proto_dataset.admin_metadata["uuid"] == proto_dataset.uuid
|
|
47
|
+
assert proto_dataset.admin_metadata["type"] == "protodataset"
|
|
48
|
+
|
|
42
49
|
assert proto_dataset.name == name
|
|
43
50
|
assert proto_dataset.get_readme_content() == readme_content
|
|
44
51
|
|
|
@@ -63,7 +70,14 @@ def test_create_derived_proto_dataset(tmp_dir_fixture): # NOQA
|
|
|
63
70
|
creator_username=creator_username
|
|
64
71
|
)
|
|
65
72
|
assert isinstance(proto_dataset, dtoolcore.ProtoDataSet)
|
|
66
|
-
|
|
73
|
+
|
|
74
|
+
assert "created_at" in proto_dataset.admin_metadata
|
|
75
|
+
assert "frozen_at" not in proto_dataset.admin_metadata
|
|
76
|
+
assert proto_dataset.admin_metadata["dtoolcore_version"] == dtoolcore.__version__ # NOQA
|
|
77
|
+
assert proto_dataset.admin_metadata["creator_username"] == creator_username # NOQA
|
|
78
|
+
assert proto_dataset.admin_metadata["uuid"] == proto_dataset.uuid
|
|
79
|
+
assert proto_dataset.admin_metadata["type"] == "protodataset"
|
|
80
|
+
|
|
67
81
|
assert proto_dataset.name == name
|
|
68
82
|
|
|
69
83
|
# Test the annotations.
|
|
@@ -97,6 +111,15 @@ def test_DataSetCreator(tmp_dir_fixture): # NOQA
|
|
|
97
111
|
# The below would raise if the dataset was not frozen.
|
|
98
112
|
dataset = dtoolcore.DataSet.from_uri(uri)
|
|
99
113
|
|
|
114
|
+
# Check admin metadata
|
|
115
|
+
assert "created_at" in dataset.admin_metadata
|
|
116
|
+
assert "frozen_at" in dataset.admin_metadata
|
|
117
|
+
assert dataset.admin_metadata["frozen_at"] >= dataset.admin_metadata["created_at"] # NOQA
|
|
118
|
+
assert dataset.admin_metadata["dtoolcore_version"] == dtoolcore.__version__ # NOQA
|
|
119
|
+
assert dataset.admin_metadata["creator_username"] == creator_username # NOQA
|
|
120
|
+
assert dataset.admin_metadata["uuid"] == dataset.uuid
|
|
121
|
+
assert dataset.admin_metadata["type"] == "dataset"
|
|
122
|
+
|
|
100
123
|
# Check the content.
|
|
101
124
|
expected_identifier = generate_identifier("subdir/tiny.png")
|
|
102
125
|
assert expected_identifier in dataset.identifiers
|
|
@@ -226,7 +249,16 @@ def test_DerivedDataSetCreator(tmp_dir_fixture): # NOQA
|
|
|
226
249
|
derived_dataset_uri = derived_dataset_creator.uri
|
|
227
250
|
|
|
228
251
|
# The below would raise if the dataset was not frozen.
|
|
229
|
-
dtoolcore.DataSet.from_uri(derived_dataset_uri)
|
|
252
|
+
dataset = dtoolcore.DataSet.from_uri(derived_dataset_uri)
|
|
253
|
+
|
|
254
|
+
# Check admin metadata
|
|
255
|
+
assert "created_at" in dataset.admin_metadata
|
|
256
|
+
assert "frozen_at" in dataset.admin_metadata
|
|
257
|
+
assert dataset.admin_metadata["frozen_at"] >= dataset.admin_metadata["created_at"] # NOQA
|
|
258
|
+
assert dataset.admin_metadata["dtoolcore_version"] == dtoolcore.__version__ # NOQA
|
|
259
|
+
assert dataset.admin_metadata["creator_username"] == creator_username # NOQA
|
|
260
|
+
assert dataset.admin_metadata["uuid"] == dataset.uuid
|
|
261
|
+
assert dataset.admin_metadata["type"] == "dataset"
|
|
230
262
|
|
|
231
263
|
|
|
232
264
|
def test_promised_abspath_missing_raises(tmp_dir_fixture): # NOQA
|
|
@@ -15,6 +15,7 @@ def test_basic_workflow(tmp_dir_fixture): # NOQA
|
|
|
15
15
|
|
|
16
16
|
from dtoolcore import ProtoDataSet, generate_admin_metadata
|
|
17
17
|
from dtoolcore import DataSet
|
|
18
|
+
from dtoolcore import __version__
|
|
18
19
|
from dtoolcore.utils import generate_identifier
|
|
19
20
|
from dtoolcore.storagebroker import DiskStorageBroker
|
|
20
21
|
|
|
@@ -41,6 +42,15 @@ def test_basic_workflow(tmp_dir_fixture): # NOQA
|
|
|
41
42
|
# Read in a dataset
|
|
42
43
|
dataset = DataSet.from_uri(dest_uri)
|
|
43
44
|
|
|
45
|
+
# Check admin metadata
|
|
46
|
+
assert "created_at" in dataset.admin_metadata
|
|
47
|
+
assert "frozen_at" in dataset.admin_metadata
|
|
48
|
+
assert "creator_username" in dataset.admin_metadata
|
|
49
|
+
assert dataset.admin_metadata["frozen_at"] >= dataset.admin_metadata["created_at"] # NOQA
|
|
50
|
+
assert dataset.admin_metadata["dtoolcore_version"] == __version__ # NOQA
|
|
51
|
+
assert dataset.admin_metadata["uuid"] == dataset.uuid
|
|
52
|
+
assert dataset.admin_metadata["type"] == "dataset"
|
|
53
|
+
|
|
44
54
|
expected_identifier = generate_identifier('tiny.png')
|
|
45
55
|
assert expected_identifier in dataset.identifiers
|
|
46
56
|
assert len(dataset.identifiers) == 1
|
|
@@ -18,12 +18,12 @@ def test_frozen_at_value_when_copying_dataset(tmp_dir_fixture): # NOQA
|
|
|
18
18
|
os.mkdir(dest_base_uri)
|
|
19
19
|
|
|
20
20
|
src_dataset = dc.DataSet.from_uri(src_uri)
|
|
21
|
-
src_frozen_at = src_dataset.
|
|
21
|
+
src_frozen_at = src_dataset.admin_metadata["frozen_at"]
|
|
22
22
|
|
|
23
23
|
time.sleep(0.1)
|
|
24
24
|
|
|
25
25
|
dest_uri = dc.copy(src_uri, dest_base_uri)
|
|
26
26
|
dest_dataset = dc.DataSet.from_uri(dest_uri)
|
|
27
|
-
dest_frozen_at = dest_dataset.
|
|
27
|
+
dest_frozen_at = dest_dataset.admin_metadata["frozen_at"]
|
|
28
28
|
|
|
29
29
|
assert src_frozen_at == dest_frozen_at
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|