class_name = 'local'
expected_class = <class 'swh.indexer.storage.IndexerStorage'>
kwargs = {'db': 'something'}
mock_psycopg2 = <pytest_mock.plugin.MockerFixture object at 0x7f04e09c1390>
@pytest.mark.parametrize("class_name,expected_class,kwargs", SERVER_IMPLEMENTATIONS)
def test_init_types(class_name, expected_class, kwargs, mock_psycopg2):
"""Checks all methods of SearchInterface are implemented by this
backend, and that they have the same signature.
"""
if kwargs:
concrete_idx_storage = get_indexer_storage(class_name, **kwargs)
else:
concrete_idx_storage = get_indexer_storage(class_name)
# Create an instance of the protocol (which cannot be instantiated
# directly, so this creates a subclass, then instantiates it)
interface = type("_", (IndexerStorageInterface,), {})()
for meth_name in dir(interface):
if meth_name.startswith("_"):
continue
interface_meth = getattr(interface, meth_name)
missing_methods = []
try:
concrete_meth = getattr(concrete_idx_storage, meth_name)
except AttributeError:
if not getattr(interface_meth, "deprecated_endpoint", False):
# The backend is missing a (non-deprecated) endpoint
missing_methods.append(meth_name)
continue
expected_signature = inspect.signature(interface_meth)
actual_signature = inspect.signature(concrete_meth)
> assert actual_signature == expected_signature, meth_name
E AssertionError: content_ctags_add
E assert <Signature (c...ct[str, int]'> == <Signature (c...ict[str, int]>
E +<Signature (ctags: 'List[ContentCtagsRow]', conflict_update: 'bool' = False) -> 'Dict[str, int]'>
E -<Signature (ctags: List[swh.indexer.storage.model.ContentCtagsRow], conflict_update: bool = False) -> Dict[str, int]>
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/storage/test_init.py:90: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Oct 15 2020, 3:49 PM