archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7fdbe4be9c18>
@given(snapshot())
> def test_lookup_snapshot_branch_name_from_tip_revision(archive_data, snapshot_id):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_archive.py:983:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_archive.py:995: in test_lookup_snapshot_branch_name_from_tip_revision
assert (
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
snapshot_id = 'a939fc6ac1a445973cd6eecc04e86afd7b46bbfa'
revision_id = '56d5c87b596bfe792f79b2e41fde83b769f6406d'
def lookup_snapshot_branch_name_from_tip_revision(
snapshot_id: str, revision_id: str
) -> Optional[str]:
"""Check if a revision corresponds to the tip of a snapshot branch
Args:
snapshot_id: hexadecimal representation of a snapshot id
revision_id: hexadecimal representation of a revision id
Returns:
The name of the first found branch or None otherwise
"""
per_page = 10000
branches_from = ""
snapshot: Dict[str, Any] = {"branches": {}}
branches = []
while not branches_from or len(snapshot["branches"]) == per_page + 1:
snapshot = lookup_snapshot(
snapshot_id,
target_types=[ObjectType.REVISION],
branches_from=branches_from,
branches_count=per_page + 1,
)
branches += [
{"name": k, "target": v["target"]} for k, v in snapshot["branches"].items()
]
> branches_from = branches[-1]["name"]
E IndexError: list index out of range
.tox/py3/lib/python3.7/site-packages/swh/web/common/archive.py:1126: IndexError
TEST RESULT
TEST RESULT
- Run At
- Mar 3 2021, 10:02 AM