Page MenuHomeSoftware Heritage
Paste P1375

(An Untitled Masterwork)
ActivePublic

Authored by anlambert on Jun 3 2022, 11:02 AM.
11:00 $ pytest -sv --hypothesis-verbosity=verbose swh/web/tests/api/views/test_metadata.py::test_api_raw_extrinsic_metadata_scroll
================================================================================================================================== test session starts ==================================================================================================================================
platform linux -- Python 3.9.2, pytest-7.1.2, pluggy-1.0.0 -- /home/anlambert/.virtualenvs/swh/bin/python
cachedir: .pytest_cache
hypothesis profile 'swh-web-fast-with-verbose-verbosity' -> deadline=None, max_examples=5, verbosity=Verbosity.verbose, database=DirectoryBasedExampleDatabase('/home/anlambert/swh/swh-environment/swh-web/.hypothesis/examples'), suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much, HealthCheck.function_scoped_fixture]
django: settings: swh.web.settings.tests (from ini)
rootdir: /home/anlambert/swh/swh-environment/swh-web, configfile: pytest.ini
plugins: redis-2.4.0, hypothesis-6.46.11, postgresql-3.1.3, forked-1.4.0, mock-3.7.0, xdist-2.5.0, cov-3.0.0, requests-mock-1.9.3, django-test-migrations-1.2.0, django-4.5.2, rabbitmq-2.2.1, typeguard-2.13.3, dash-2.3.1, mongodb-2.2.0, asyncio-0.18.3, swh.journal-1.0.1.dev8+g50bdea7, swh.core-2.5.1.dev6+gfcbaa04.d20220517
asyncio: mode=strict
collected 4 items
swh/web/tests/api/views/test_metadata.py::test_api_raw_extrinsic_metadata_scroll[1] Trying example: test_api_raw_extrinsic_metadata_scroll(
meta={RawExtrinsicMetadata(target=ExtendedSWHID.from_string('swh:1:rev:93c482accab7aa9753677e3922fec606b256e276'), discovery_date=datetime.datetime(7889, 10, 29, 18, 6, 35, tzinfo=datetime.timezone.utc), authority=MetadataAuthority(type=MetadataAuthorityType.REGISTRY, url='https://it0️w6a.3lé3géda', metadata=None), fetcher=MetadataFetcher(name='2DhV', version='Op4>cmzygy~!7&y', metadata=None), format='bzaRxrR', metadata=b'\xfdU\x04\xcds\xe0', origin=None, visit=None, snapshot=None, release=None, revision=None, path=None, directory=None, id=hash_to_bytes('a809640c2fabe3316e59e795fb75f834c569cb50')),
RawExtrinsicMetadata(target=ExtendedSWHID.from_string('swh:1:cnt:dd41700baa82944efae4e1dff75471d0eeb4b32a'), discovery_date=datetime.datetime(5546, 2, 14, 19, 27, 55, tzinfo=datetime.timezone.utc), authority=MetadataAuthority(type=MetadataAuthorityType.DEPOSIT_CLIENT, url='http://xxaul.lf.wh3.ég1y2p', metadata=None), fetcher=MetadataFetcher(name='<zDMz},-s)', version=':py', metadata=None), format='e{', metadata=b'\x1e\xe6', origin=None, visit=None, snapshot=None, release=None, revision=None, path=None, directory=None, id=hash_to_bytes('0ca4770b3bd166db2d11c73fb3386abc1a63b2af'))},
api_client=<rest_framework.test.APIClient at 0x7ff18fb3f370>,
subtest=inner,
limit=1,
)
api_client = <rest_framework.test.APIClient object at 0x7ff18fb3f370>, subtest = <function subtest.<locals>.inner at 0x7ff18fadc160>, limit = 1
meta = {RawExtrinsicMetadata(target=ExtendedSWHID.from_string('swh:1:rev:93c482accab7aa9753677e3922fec606b256e276'), discover... release=None, revision=None, path=None, directory=None, id=hash_to_bytes('0ca4770b3bd166db2d11c73fb3386abc1a63b2af'))}
@pytest.mark.parametrize("limit", [1, 2, 10, 100])
@given(sets(raw_extrinsic_metadata(), min_size=1))
def test_api_raw_extrinsic_metadata_scroll(api_client, subtest, limit, meta):
# ensure archive_data fixture will be reset between each hypothesis
# example test run
@subtest
> def test_inner(archive_data):
swh/web/tests/api/views/test_metadata.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swh/web/tests/conftest.py:1106: in inner
item.ihook.pytest_runtest_call(item=item)
../../../.virtualenvs/swh/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
../../../.virtualenvs/swh/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../../../.virtualenvs/swh/lib/python3.9/site-packages/_pytest/runner.py:174: in pytest_runtest_call
raise e
../../../.virtualenvs/swh/lib/python3.9/site-packages/_pytest/runner.py:166: in pytest_runtest_call
item.runtest()
../../../.virtualenvs/swh/lib/python3.9/site-packages/_pytest/python.py:1761: in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
../../../.virtualenvs/swh/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
../../../.virtualenvs/swh/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../../../.virtualenvs/swh/lib/python3.9/site-packages/_pytest/python.py:192: in pytest_pyfunc_call
result = testfunction(**testargs)
swh/web/tests/api/views/test_metadata.py:105: in test_inner
results = scroll_results(api_client, url)
swh/web/tests/api/views/utils.py:16: in scroll_results
rv = check_api_get_responses(api_client, url, status_code=200)
swh/web/tests/utils.py:122: in check_api_get_responses
response_json = check_http_get_response(
swh/web/tests/utils.py:60: in check_http_get_response
return _assert_http_response(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <Response status_code=500, "application/json">, status_code = 200, content_type = 'application/json'
def _assert_http_response(
response: HttpResponseBase, status_code: int, content_type: str
) -> HttpResponseBase:
if isinstance(response, Response):
drf_response = cast(Response, response)
error_context = (
drf_response.data.pop("traceback")
if isinstance(drf_response.data, dict) and "traceback" in drf_response.data
else drf_response.data
)
elif isinstance(response, StreamingHttpResponse):
error_context = getattr(response, "traceback", response.streaming_content)
elif isinstance(response, HttpResponse):
error_context = getattr(response, "traceback", response.content)
> assert response.status_code == status_code, error_context
E AssertionError: Traceback (most recent call last):
E File "/home/anlambert/.virtualenvs/swh/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
E response = handler(request, *args, **kwargs)
E File "/home/anlambert/.virtualenvs/swh/lib/python3.9/site-packages/rest_framework/decorators.py", line 50, in handler
E return func(*args, **kwargs)
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apiurls.py", line 96, in api_view_f
E response = f(request, **kwargs)
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apidoc.py", line 380, in documented_view
E raise exc
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apidoc.py", line 377, in documented_view
E return {"data": f(request, **kwargs), "doc_data": doc_data}
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/views/metadata.py", line 118, in api_raw_extrinsic_metadata_swhid
E result_page = archive.storage.raw_extrinsic_metadata_get(
E File "/home/anlambert/swh/swh-environment/swh-storage/swh/storage/cassandra/storage.py", line 1514, in raw_extrinsic_metadata_get
E (after_date, id_) = msgpack_loads(base64.b64decode(page_token))
E File "/home/anlambert/swh/swh-environment/swh-core/swh/core/api/serializers.py", line 310, in msgpack_loads
E return msgpack.unpackb(
E File "msgpack/_unpacker.pyx", line 194, in msgpack._cmsgpack.unpackb
E ValueError: 11 exceeds max_array_len(6)
E
E assert 500 == 200
E + where 500 = <Response status_code=500, "application/json">.status_code
swh/web/tests/utils.py:34: AssertionError