Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_revision_content_layer.py
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | for synth_rev in synthetic_revision_content_result(syntheticfile): | ||||
) | ) | ||||
directories = [ | directories = [ | ||||
DirectoryEntry(id=sha1) | DirectoryEntry(id=sha1) | ||||
for sha1 in provenance.storage.entity_get_all( | for sha1 in provenance.storage.entity_get_all( | ||||
EntityType.DIRECTORY | EntityType.DIRECTORY | ||||
).difference(prev_directories) | ).difference(prev_directories) | ||||
] | ] | ||||
for directory in directories: | for directory in directories: | ||||
assert not provenance.directory_already_flattenned(directory) | assert not provenance.directory_already_flattened(directory) | ||||
directory_add(provenance, archive, directories) | directory_add(provenance, archive, directories) | ||||
# each "entry" in the synth file is one new revision | # each "entry" in the synth file is one new revision | ||||
rows["revision"].add(synth_rev["sha1"]) | rows["revision"].add(synth_rev["sha1"]) | ||||
assert rows["revision"] == provenance.storage.entity_get_all( | assert rows["revision"] == provenance.storage.entity_get_all( | ||||
EntityType.REVISION | EntityType.REVISION | ||||
), synth_rev["msg"] | ), synth_rev["msg"] | ||||
# check the timestamp of the revision | # check the timestamp of the revision | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | for synth_rev in synthetic_revision_content_result(syntheticfile): | ||||
== provenance.storage.content_get([dc["dst"]])[dc["dst"]].timestamp() | == provenance.storage.content_get([dc["dst"]])[dc["dst"]].timestamp() | ||||
), synth_rev["msg"] | ), synth_rev["msg"] | ||||
if provenance.storage.with_path(): | if provenance.storage.with_path(): | ||||
# check for location entries | # check for location entries | ||||
rows["location"] |= set(x["path"].encode() for x in synth_rev["R_C"]) | rows["location"] |= set(x["path"].encode() for x in synth_rev["R_C"]) | ||||
rows["location"] |= set(x["path"].encode() for x in synth_rev["D_C"]) | rows["location"] |= set(x["path"].encode() for x in synth_rev["D_C"]) | ||||
rows["location"] |= set(x["path"].encode() for x in synth_rev["R_D"]) | rows["location"] |= set(x["path"].encode() for x in synth_rev["R_D"]) | ||||
assert rows["location"] == provenance.storage.location_get_all(), synth_rev[ | assert rows["location"] == set( | ||||
"msg" | provenance.storage.location_get_all().values() | ||||
] | ), synth_rev["msg"] | ||||
@pytest.mark.parametrize( | @pytest.mark.parametrize( | ||||
"repo, lower, mindepth", | "repo, lower, mindepth", | ||||
( | ( | ||||
("cmdbts2", True, 1), | ("cmdbts2", True, 1), | ||||
("cmdbts2", False, 1), | ("cmdbts2", False, 1), | ||||
("cmdbts2", True, 2), | ("cmdbts2", True, 2), | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |