Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_isochrone_graph.py
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | with open(get_datafile(filename)) as file: | ||||
root=revision["directory"], | root=revision["directory"], | ||||
) | ) | ||||
expected_graph = isochrone_graph_from_dict(expected["graph"]) | expected_graph = isochrone_graph_from_dict(expected["graph"]) | ||||
print("Expected graph:", expected_graph) | print("Expected graph:", expected_graph) | ||||
# Create graph for current revision and check it has the expected structure. | # Create graph for current revision and check it has the expected structure. | ||||
assert entry.root is not None | assert entry.root is not None | ||||
computed_graph = build_isochrone_graph( | computed_graph = build_isochrone_graph( | ||||
archive, | |||||
provenance, | provenance, | ||||
archive, | |||||
entry, | entry, | ||||
DirectoryEntry(entry.root), | DirectoryEntry(entry.root), | ||||
) | ) | ||||
print("Computed graph:", computed_graph) | print("Computed graph:", computed_graph) | ||||
assert computed_graph == expected_graph | assert computed_graph == expected_graph | ||||
# Add current revision so that provenance info is kept up to date for the | # Add current revision so that provenance info is kept up to date for the | ||||
# following ones. | # following ones. | ||||
revision_add( | revision_add( | ||||
provenance, | provenance, | ||||
archive, | archive, | ||||
[entry], | [entry], | ||||
lower=lower, | lower=lower, | ||||
mindepth=mindepth, | mindepth=mindepth, | ||||
commit=not batch, | commit=not batch, | ||||
) | ) |