self = <swh.storage.tests.test_tenacious.TestTenaciousStorage object at 0x7fef891b7748>
swh_storage = <swh.storage.proxies.tenacious.TenaciousProxyStorage object at 0x7fef891b7eb8>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7fef82c29390>
def test_content_missing_per_sha1(self, swh_storage, sample_data):
# given
cont = sample_data.content
cont2 = sample_data.content2
missing_cont = sample_data.skipped_content
missing_cont2 = sample_data.skipped_content2
swh_storage.content_add([cont, cont2])
# when
gen = swh_storage.content_missing_per_sha1(
[cont.sha1, missing_cont.sha1, cont2.sha1, missing_cont2.sha1]
)
# then
> assert list(gen) == [missing_cont.sha1, missing_cont2.sha1]
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/storage_tests.py:541:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7fef891b78d0>
contents = [{'sha1': b'4\x972t\xcc\xefj\xb4\xdf\xaa\xf8e\x99y/\xa9\xc3\xfeF\x89'}, {'sha1': b'C\xe4]V\xf8\x89\x93\xaa\xe6\xa0\x19...f7\r\xd2\xd7\xe0\x97\x04m\x07\xb7'}, {'sha1': b'T\xe4]V\xf8\x89\x93\xaa\xe6\xa0\x19\x80\x13\xef\xa8\x07\x16\xfd\x89 '}]
key_hash = 'sha1'
@timed
def content_missing(
self, contents: List[Dict[str, Any]], key_hash: str = "sha1"
) -> Iterable[bytes]:
if key_hash not in DEFAULT_ALGORITHMS:
raise StorageArgumentException(
"key_hash should be one of {','.join(DEFAULT_ALGORITHMS)}"
)
contents_with_all_hashes = []
contents_with_missing_hashes = []
for content in contents:
if DEFAULT_ALGORITHMS <= set(content):
contents_with_all_hashes.append(content)
else:
contents_with_missing_hashes.append(content)
# These contents can be queried efficiently directly in the main table
> for content in self._cql_runner.content_missing_from_all_hashes(
contents_with_all_hashes
):
E AttributeError: 'InMemoryCqlRunner' object has no attribute 'content_missing_from_all_hashes'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:406: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jan 6 2022, 5:39 PM