Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_retry::test_retrying_proxy_storage_directory_add_with_retry
Failed

TEST RESULT

Run At
Aug 3 2020, 1:31 PM
Details
monkeypatch_sleep = <_pytest.monkeypatch.MonkeyPatch object at 0x7fdf05aa10b8> swh_storage = <swh.storage.retry.RetryingProxyStorage object at 0x7fdf05aa11d0> sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fdf05aa1198> mocker = <pytest_mock.plugin.MockFixture object at 0x7fdf05aa1240> fake_hash_collision = HashCollision('sha1', '38762cf7f55934b34d179ae6a4c80cadccbb7f0a', []) def test_retrying_proxy_storage_directory_add_with_retry( monkeypatch_sleep, swh_storage, sample_data, mocker, fake_hash_collision ): """Multiple retries for hash collision and psycopg2 error but finally ok """ mock_memory = mocker.patch("swh.storage.in_memory.InMemoryStorage.directory_add") mock_memory.side_effect = [ # first try goes ko fake_hash_collision, # second try goes ko psycopg2.IntegrityError("directory already inserted"), # ok then! {"directory:add": 1}, ] sample_dir = sample_data.directories[1] > directory_id = swh_storage.directory_get_random() # no directory .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_retry.py:594: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .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