self = <swh.storage.tests.test_tenacious.TestTenaciousStorage object at 0x7f001b14a1d0>
swh_storage = <swh.storage.proxies.tenacious.TenaciousProxyStorage object at 0x7f0017e4ab00>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f0011be2da0>
def test_content_get_random(self, swh_storage, sample_data):
cont, cont2, cont3 = sample_data.contents[:3]
swh_storage.content_add([cont, cont2, cont3])
> assert swh_storage.content_get_random() in {
cont.sha1_git,
cont2.sha1_git,
cont3.sha1_git,
}
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/storage_tests.py:685:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/metrics.py:24: in d
return f(*a, **kw)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:430: in content_get_random
content = self._cql_runner.content_get_random()
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:205: in content_get_random
return self._contents.get_random()
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:150: in get_random
return random.choice([row for (pk, row) in self.iter_all()])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <random.Random object at 0x1e6e9d8>, 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
- Sep 15 2021, 3:20 PM