mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8baf584390>
class_ = 'memory'
expected_class = <class 'swh.search.in_memory.InMemorySearch'>, kwargs = None
@pytest.mark.parametrize("class_,expected_class,kwargs", SEARCH_IMPLEMENTATIONS)
def test_types(mocker, class_, expected_class, kwargs):
"""Checks all methods of SearchInterface are implemented by this
backend, and that they have the same signature.
"""
mocker.patch("swh.search.elasticsearch.Elasticsearch")
if kwargs:
concrete_search = get_search(class_, **kwargs)
else:
concrete_search = get_search(class_)
# Create an instance of the protocol (which cannot be instantiated
# directly, so this creates a subclass, then instantiates it)
interface = type("_", (SearchInterface,), {})()
for meth_name in dir(interface):
if meth_name.startswith("_"):
continue
interface_meth = getattr(interface, meth_name)
missing_methods = []
try:
concrete_meth = getattr(concrete_search, 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 expected_signature == actual_signature, meth_name
E AssertionError: origin_search
E assert <Signature (*...ginDict, str]> == <Signature (*...ginDict, str]>
E +<Signature (*, url_pattern: Union[str, NoneType] = None, metadata_pattern: Union[str, NoneType] = None, with_visit: bool = False, visit_types: Union[List[str], NoneType] = None, page_token: Union[str, NoneType] = None, min_nb_visits: int = None, min_last_visit_date: str = None, limit: int = 50) -> swh.core.api.classes.PagedResult[swh.search.interface.MinimalOriginDict, str]>
E -<Signature (*, url_pattern: Union[str, NoneType] = None, metadata_pattern: Union[str, NoneType] = None, with_visit: bool = False, visit_types: Union[List[str], NoneType] = None, page_token: Union[s...
E
E ...Full output truncated (1 line hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_init.py:86: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 14 2021, 6:46 PM