archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7fdb38489a20>
@given(directory(), revision())
> def test_lookup_snapshot_branch_names_filtering_paginated(
archive_data, directory, revision
):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_archive.py:1095:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_archive.py:1128: in test_lookup_snapshot_branch_names_filtering_paginated
branch_name_includes=[pattern],
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
snapshot_id = 'd6d23726657a4a4f8d344b2c8a249a111dc9ccd4', branches_from = ''
branches_count = 5, target_types = ['directory'], branch_name_includes = ['foo']
branch_name_excludes = None
def lookup_snapshot(
snapshot_id: str,
branches_from: str = "",
branches_count: int = 1000,
target_types: Optional[List[str]] = None,
branch_name_includes: Optional[List[str]] = None,
branch_name_excludes: Optional[List[str]] = None,
) -> Dict[str, Any]:
"""Return information about a snapshot, aka the list of named
branches found during a specific visit of an origin.
Args:
snapshot_id: sha1 identifier of the snapshot
branches_from: optional parameter used to skip branches
whose name is lesser than it before returning them
branches_count: optional parameter used to restrain
the amount of returned branches
target_types: optional parameter used to filter the
target types of branch to return (possible values that can be
contained in that list are `'content', 'directory',
'revision', 'release', 'snapshot', 'alias'`)
branch_name_includes: optional parameter used to filter branches
according to their names, only those whose name is containing
one of the substring in the provided list will be returned
branch_name_excludes: optional parameter used to filter out branches
according to their names, those whose name is containing one of
the substring in the provided list will not be returned
Returns:
A dict filled with the snapshot content.
"""
snapshot_id_bin = _to_sha1_bin(snapshot_id)
branches_name_pattern = None
if branch_name_includes and branch_name_excludes:
includes = "|".join([re.escape(include) for include in branch_name_includes])
excludes = "|".join([re.escape(exclude) for exclude in branch_name_excludes])
branches_name_pattern = (
f"^(?:(?!(?:{excludes})).)*(?:{includes})(?:(?!(?:{excludes})).)*$"
)
elif branch_name_includes:
branches_name_pattern = "|".join(
[re.escape(include) for include in branch_name_includes]
)
elif branch_name_excludes:
excludes = "|".join([re.escape(exclude) for exclude in branch_name_excludes])
branches_name_pattern = f"^((?!{excludes}).)*$"
partial_branches = storage.snapshot_get_branches(
snapshot_id_bin,
branches_from.encode(),
branches_count,
target_types,
> branches_name_pattern,
)
E TypeError: snapshot_get_branches() takes from 2 to 5 positional arguments but 6 were given
.tox/py3/lib/python3.7/site-packages/swh/web/common/archive.py:1069: TypeError
TEST RESULT
TEST RESULT
- Run At
- Nov 26 2020, 6:22 PM