Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123661
D8592.id31044.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D8592.id31044.diff
View Options
diff --git a/swh/provenance/tests/test_cli.py b/swh/provenance/tests/test_cli.py
--- a/swh/provenance/tests/test_cli.py
+++ b/swh/provenance/tests/test_cli.py
@@ -115,6 +115,7 @@
assert cur.fetchone() == ("with-path",)
+@pytest.mark.origin_layer
@pytest.mark.parametrize(
"subcommand",
(["origin", "from-csv"], ["iter-origins"]),
diff --git a/swh/provenance/tests/test_history_graph.py b/swh/provenance/tests/test_history_graph.py
--- a/swh/provenance/tests/test_history_graph.py
+++ b/swh/provenance/tests/test_history_graph.py
@@ -15,6 +15,7 @@
from swh.provenance.tests.conftest import fill_storage, get_datafile, load_repo_data
+@pytest.mark.origin_layer
@pytest.mark.parametrize(
"repo, visit",
(("with-merges", "visits-01"),),
diff --git a/swh/provenance/tests/test_journal_client.py b/swh/provenance/tests/test_journal_client.py
--- a/swh/provenance/tests/test_journal_client.py
+++ b/swh/provenance/tests/test_journal_client.py
@@ -27,6 +27,7 @@
yield {**swh_storage_backend_config, "journal_writer": writer_config}
+@pytest.mark.origin_layer
def test_cli_origin_from_journal_client(
swh_storage: StorageInterface,
swh_storage_backend_config: Dict,
diff --git a/swh/provenance/tests/test_origin_iterator.py b/swh/provenance/tests/test_origin_iterator.py
--- a/swh/provenance/tests/test_origin_iterator.py
+++ b/swh/provenance/tests/test_origin_iterator.py
@@ -15,6 +15,7 @@
from swh.storage.interface import StorageInterface
+@pytest.mark.origin_layer
@pytest.mark.parametrize(
"repo",
(
diff --git a/swh/provenance/tests/test_origin_revision_layer.py b/swh/provenance/tests/test_origin_revision_layer.py
--- a/swh/provenance/tests/test_origin_revision_layer.py
+++ b/swh/provenance/tests/test_origin_revision_layer.py
@@ -112,6 +112,7 @@
return org
+@pytest.mark.origin_layer
@pytest.mark.parametrize(
"repo, visit",
(("with-merges", "visits-01"),),
diff --git a/swh/provenance/tests/test_provenance_storage.py b/swh/provenance/tests/test_provenance_storage.py
--- a/swh/provenance/tests/test_provenance_storage.py
+++ b/swh/provenance/tests/test_provenance_storage.py
@@ -8,6 +8,8 @@
import os
from typing import Any, Dict, Iterable, Optional, Set, Tuple
+import pytest
+
from swh.model.hashutil import hash_to_bytes
from swh.model.model import Origin, Sha1Git
from swh.provenance.archive import ArchiveInterface
@@ -105,6 +107,7 @@
else:
assert provenance_storage.location_get_all() == set()
+ @pytest.mark.origin_layer
def test_provenance_storage_origin(
self,
provenance_storage: ProvenanceStorageInterface,
@@ -157,7 +160,7 @@
rev_data.keys()
)
- def test_provenance_storage_relation(
+ def test_provenance_storage_relation_revision_layer(
self,
provenance_storage: ProvenanceStorageInterface,
) -> None:
@@ -202,6 +205,16 @@
provenance_storage, RelationType.DIR_IN_REV, dir_in_rev
)
+ @pytest.mark.origin_layer
+ def test_provenance_storage_relation_orign_layer(
+ self,
+ provenance_storage: ProvenanceStorageInterface,
+ ) -> None:
+ """Tests relation methods for every `ProvenanceStorageInterface` implementation."""
+
+ # Read data/README.md for more details on how these datasets are generated.
+ data = load_repo_data("cmdbts2")
+
# Test revision-in-origin relation.
# Origins must be inserted in advance (cannot be done by `entity_add` inside
# `relation_add_and_compare_result`).
@@ -238,7 +251,7 @@
provenance_storage, RelationType.REV_BEFORE_REV, rev_before_rev
)
- def test_provenance_storage_find(
+ def test_provenance_storage_find_revision_layer(
self,
provenance: ProvenanceInterface,
provenance_storage: ProvenanceStorageInterface,
@@ -298,6 +311,44 @@
for occur in provenance.storage.content_find_all(cnt)
} == set(provenance_storage.content_find_all(cnt))
+ @pytest.mark.origin_layer
+ def test_provenance_storage_find_origin_layer(
+ self,
+ provenance: ProvenanceInterface,
+ provenance_storage: ProvenanceStorageInterface,
+ archive: ArchiveInterface,
+ ) -> None:
+ """Tests `content_find_first` and `content_find_all` methods for every
+ `ProvenanceStorageInterface` implementation.
+ """
+
+ # Read data/README.md for more details on how these datasets are generated.
+ data = load_repo_data("cmdbts2")
+ fill_storage(archive.storage, data)
+
+ # Execute the revision-content algorithm on both storages.
+ revisions = [
+ RevisionEntry(id=rev["id"], date=ts2dt(rev["date"]), root=rev["directory"])
+ for rev in data["revision"]
+ ]
+ revision_add(provenance, archive, revisions)
+ revision_add(Provenance(provenance_storage), archive, revisions)
+
+ # Test content_find_first and content_find_all, first only executing the
+ # revision-content algorithm, then adding the origin-revision layer.
+ def adapt_result(
+ result: Optional[ProvenanceResult], with_path: bool
+ ) -> Optional[ProvenanceResult]:
+ if result is not None:
+ return ProvenanceResult(
+ result.content,
+ result.revision,
+ result.date,
+ result.origin,
+ result.path if with_path else b"",
+ )
+ return result
+
# Execute the origin-revision algorithm on both storages.
origins = [
OriginEntry(url=sta["origin"], snapshot=sta["snapshot"])
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 19 2024, 5:14 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217456
Attached To
D8592: Mark origin layer tests as "origin_layer"
Event Timeline
Log In to Comment