Page MenuHomeSoftware Heritage

D5388.diff
No OneTemporary

D5388.diff

diff --git a/swh/provenance/tests/conftest.py b/swh/provenance/tests/conftest.py
--- a/swh/provenance/tests/conftest.py
+++ b/swh/provenance/tests/conftest.py
@@ -77,7 +77,8 @@
@pytest.fixture
-def archive_pg(swh_storage_with_objects):
+def archive(swh_storage_with_objects):
+ """Return a ArchivePostgreSQL based StorageInterface object"""
# this is a workaround to prevent tests from hanging because of an unclosed
# transaction.
# TODO: refactor the ArchivePostgreSQL to properly deal with
diff --git a/swh/provenance/tests/test_provenance_db.py b/swh/provenance/tests/test_provenance_db.py
--- a/swh/provenance/tests/test_provenance_db.py
+++ b/swh/provenance/tests/test_provenance_db.py
@@ -31,7 +31,7 @@
# TODO: check some facts here
-def test_provenance_add_revision(provenance, storage_and_CMDBTS, archive_pg):
+def test_provenance_add_revision(provenance, storage_and_CMDBTS, archive):
storage, data = storage_and_CMDBTS
for i in range(2):
@@ -42,7 +42,7 @@
date=ts2dt(revision["date"]),
root=revision["directory"],
)
- revision_add(provenance, archive_pg, entry)
+ revision_add(provenance, archive, entry)
# there should be as many entries in 'revision' as revisions from the
# test dataset
@@ -78,13 +78,13 @@
assert provenance.cursor.fetchone()[0] == 13
-def test_provenance_content_find_first(provenance, storage_and_CMDBTS, archive_pg):
+def test_provenance_content_find_first(provenance, storage_and_CMDBTS, archive):
storage, data = storage_and_CMDBTS
for revision in data["revision"]:
entry = RevisionEntry(
id=revision["id"], date=ts2dt(revision["date"]), root=revision["directory"],
)
- revision_add(provenance, archive_pg, entry)
+ revision_add(provenance, archive, entry)
first_expected_content = [
{
@@ -168,7 +168,7 @@
("synthetic_noroot_upper.txt", {"lower": False, "mindepth": 1}),
),
)
-def test_provenance_db(provenance, storage_and_CMDBTS, archive_pg, syntheticfile, args):
+def test_provenance_db(provenance, storage_and_CMDBTS, archive, syntheticfile, args):
storage, data = storage_and_CMDBTS
revisions = {rev["id"]: rev for rev in data["revision"]}
@@ -192,7 +192,7 @@
entry = RevisionEntry(
id=revision["id"], date=ts2dt(revision["date"]), root=revision["directory"],
)
- revision_add(provenance, archive_pg, entry, **args)
+ revision_add(provenance, archive, entry, **args)
# import pdb; pdb.set_trace()
# each "entry" in the synth file is one new revision
diff --git a/swh/provenance/tests/test_provenance_db_storage.py b/swh/provenance/tests/test_provenance_db_storage.py
new file mode 100644
--- /dev/null
+++ b/swh/provenance/tests/test_provenance_db_storage.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2021 The Software Heritage developers
+# See the AUTHORS file at the top-level directory of this distribution
+# License: GNU General Public License version 3, or any later version
+# See top-level LICENSE file for more information
+
+import pytest
+
+from swh.provenance.storage.archive import ArchiveStorage
+
+from .test_provenance_db import ( # noqa
+ test_provenance_add_revision,
+ test_provenance_content_find_first,
+ test_provenance_db,
+)
+
+
+@pytest.fixture
+def archive(swh_storage_with_objects):
+ """Return a ArchiveStorage based StorageInterface object"""
+ archive = ArchiveStorage(swh_storage_with_objects)
+ yield archive

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 5:51 PM (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217679

Event Timeline