You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was first introduced in #212, but used the dataverse_collection, hence turned all collections into published collections. The following patch is a sketch of a fixture that creates a dedicated/separate published collection.
diff --git a/datalad_dataverse/tests/fixtures.py b/datalad_dataverse/tests/fixtures.py
index dceda34..6c554f4 100644
--- a/datalad_dataverse/tests/fixtures.py+++ b/datalad_dataverse/tests/fixtures.py@@ -78,24 +78,32 @@ def dataverse_collection(dataverse_admin_api,
@pytest.fixture(autouse=False, scope='session')
-def dataverse_published_collection(dataverse_admin_api, dataverse_collection):+def dataverse_published_collection(dataverse_admin_api,+ dataverse_demoinstance_url,+ dataverse_instance_url):
# This may not work in all test setups due to lack of permissions or /root
- # not being published or it being published already. Try though, since it's- # necessary to publish datasets in order to test against dataverse datasets- # with several versions.- from pyDataverse.exceptions import (- ApiAuthorizationError,- OperationFailedError,+ # not being published or it being published already.+ from uuid import uuid1+ # very much like a non-published collection+ base_collection = 'demo' \+ if dataverse_instance_url == dataverse_demoinstance_url else 'root'++ collection_alias = f'dvpub-{uuid1()}'++ create_test_dataverse_collection(+ dataverse_admin_api,+ collection_alias,+ collection=base_collection,
)
+
try:
- dataverse_admin_api.publish_dataverse(dataverse_collection)- except ApiAuthorizationError:- # Test setup doesn't allow for it- pass- except OperationFailedError as e:- print(str(e))+ dataverse_admin_api.publish_dataverse(collection_alias)+ except Exception as e:+ pytest.skip(f'Could not publish a dataverse collection: {str(e)}')- yield dataverse_collection+ yield collection_alias++ dataverse_admin_api.delete_dataverse(collection_alias)
Given that a cleanup of such test artifacts requires superuser permissions, the fixture must also test/ensure the availability of such permissions, or skip a test.
The text was updated successfully, but these errors were encountered:
mih
added a commit
to mih/datalad-dataverse
that referenced
this issue
Mar 13, 2023
ATM we are no capable of cleaning up such datasets after a testrun,
because we do not have superuser permissions on demo.dataverse.org
This also removed the now obsolete test fixtures.
Issue datalad#216 tracks a suitable fix.
Closesdatalad#215
ATM we are no capable of cleaning up such datasets after a testrun,
because we do not have superuser permissions on demo.dataverse.org
This also removed the now obsolete test fixtures.
Issue datalad#216 tracks a suitable fix.
Closesdatalad#215
This was first introduced in #212, but used the
dataverse_collection
, hence turned all collections into published collections. The following patch is a sketch of a fixture that creates a dedicated/separate published collection.Given that a cleanup of such test artifacts requires superuser permissions, the fixture must also test/ensure the availability of such permissions, or skip a test.
The text was updated successfully, but these errors were encountered: