Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/tests/test_from_disk.py
Show All 18 Lines | |||||
from ..from_disk import HgDirectory, HgLoaderFromDisk | from ..from_disk import HgDirectory, HgLoaderFromDisk | ||||
from .loader_checker import ExpectedSwhids, LoaderChecker | from .loader_checker import ExpectedSwhids, LoaderChecker | ||||
def test_hg_directory_creates_missing_directories(): | def test_hg_directory_creates_missing_directories(): | ||||
directory = HgDirectory() | directory = HgDirectory() | ||||
directory[b"path/to/some/content"] = Content() | directory[b"path/to/some/content"] = Content() | ||||
def test_hg_directory_deletes_empty_directories(): | |||||
directory = HgDirectory() | |||||
directory[b"path/to/content"] = Content() | |||||
directory[b"path/to/some/content"] = Content() | |||||
del directory[b"path/to/some/content"] | |||||
marmoute: You should add a variant with a mix of empty and non empty directory. To make sure we do not… | |||||
assert len(directory) == 1 | |||||
marmouteUnsubmitted Done Inline ActionsThe length on that directory will always be (1), even if some was not deleted. So you need to check that len('path/some') is 1. marmoute: The length on that directory will always be (1), even if `some` was not deleted. So you need to… | |||||
# Those tests assert expectations on repository loading | # Those tests assert expectations on repository loading | ||||
# by reading expected values from associated json files | # by reading expected values from associated json files | ||||
# produced by the `swh-hg-identify` command line utility. | # produced by the `swh-hg-identify` command line utility. | ||||
# | # | ||||
# It has more granularity than historical tests. | # It has more granularity than historical tests. | ||||
# Assertions will tell if the error comes from the directories | # Assertions will tell if the error comes from the directories | ||||
# revisions or release rather than only checking the snapshot. | # revisions or release rather than only checking the snapshot. | ||||
# | # | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |
You should add a variant with a mix of empty and non empty directory. To make sure we do not over delete.