swh_storage = <swh.storage.retry.RetryingProxyStorage object at 0x7fdf05181a90>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fdf05181208>
mocker = <pytest_mock.plugin.MockFixture object at 0x7fdf05181048>
def test_retrying_proxy_swh_storage_directory_add_failure(
swh_storage, sample_data, mocker
):
"""Unfiltered errors are raising without retry
"""
mock_memory = mocker.patch("swh.storage.in_memory.InMemoryStorage.directory_add")
mock_memory.side_effect = StorageArgumentException(
"Refuse to add directory always!"
)
sample_dir = sample_data.directory
> directory_id = swh_storage.directory_get_random() # no directory
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_retry.py:620:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:458: in directory_get_random
return random.choice(list(self._directories))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <random.Random object at 0x1946b28>, seq = []
def choice(self, seq):
"""Choose a random element from a non-empty sequence."""
try:
i = self._randbelow(len(seq))
except ValueError:
> raise IndexError('Cannot choose from an empty sequence') from None
E IndexError: Cannot choose from an empty sequence
/usr/lib/python3.7/random.py:261: IndexError
TEST RESULT
TEST RESULT
- Run At
- Aug 3 2020, 1:31 PM