Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_directory_flatten.py
# Copyright (C) 2021 The Software Heritage developers | # Copyright (C) 2021-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from datetime import datetime, timezone | from datetime import datetime, timezone | ||||
from typing import Tuple | from typing import Tuple | ||||
from swh.model.hashutil import hash_to_bytes | from swh.model.hashutil import hash_to_bytes | ||||
from swh.provenance.algos.directory import directory_add, directory_flatten_range | |||||
from swh.provenance.archive import ArchiveInterface | from swh.provenance.archive import ArchiveInterface | ||||
from swh.provenance.directory import directory_add, directory_flatten_range | from swh.provenance.interface import ProvenanceInterface | ||||
from swh.provenance.interface import ( | |||||
DirectoryData, | |||||
ProvenanceInterface, | |||||
RelationData, | |||||
RelationType, | |||||
) | |||||
from swh.provenance.model import DirectoryEntry, FileEntry | from swh.provenance.model import DirectoryEntry, FileEntry | ||||
from swh.provenance.storage.interface import DirectoryData, RelationData, RelationType | |||||
from swh.provenance.tests.conftest import fill_storage, load_repo_data | from swh.provenance.tests.conftest import fill_storage, load_repo_data | ||||
def prepare( | def prepare( | ||||
provenance: ProvenanceInterface, archive: ArchiveInterface | provenance: ProvenanceInterface, archive: ArchiveInterface | ||||
) -> Tuple[datetime, DirectoryEntry, FileEntry, FileEntry]: | ) -> Tuple[datetime, DirectoryEntry, FileEntry, FileEntry]: | ||||
"""Prepare the provenance database with some content suitable for flattening tests""" | """Prepare the provenance database with some content suitable for flattening tests""" | ||||
# read data/README.md for more details on how these datasets are generated | # read data/README.md for more details on how these datasets are generated | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |