monkeypatch_sleep = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1776da4ac8>
swh_storage = <swh.storage.retry.RetryingProxyStorage object at 0x7f1776da4a20>
sample_data_model = {'authority': [MetadataAuthority(type=<MetadataAuthorityType.DEPOSIT_CLIENT: 'deposit_client'>, url='http://hal.inria....11', length=7, status='visible', data=b'424242\n', ctime=datetime.datetime(2019, 12, 1, 0, 0, tzinfo=tzlocal()))], ...}
mocker = <pytest_mock.plugin.MockFixture object at 0x7f1777df6048>
fake_hash_collision = HashCollision('sha1', '38762cf7f55934b34d179ae6a4c80cadccbb7f0a', [])
def test_retrying_proxy_storage_object_metadata_add_with_retry(
monkeypatch_sleep, swh_storage, sample_data_model, mocker, fake_hash_collision,
):
"""Multiple retries for hash collision and psycopg2 error but finally ok
"""
ori_meta = sample_data_model["origin_metadata"][0]
> swh_storage.origin_add([{"url": ori_meta.id}])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_retry.py:508:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7f1776da4e10>
origins = [{'url': 'file:///dev/null'}]
def origin_add(self, origins: Iterable[Origin]) -> Dict[str, int]:
origins = list(origins)
added = 0
for origin in origins:
> if origin.url not in self._origins:
E AttributeError: 'dict' object has no attribute 'url'
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:782: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jul 21 2020, 9:55 AM