Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.scheduler.tests.test_api_client.TestScheduler::test_grab_next_visits[oldest_scheduled_first]
Failed

TEST RESULT

Run At
Jan 20 2021, 12:53 PM
Details
data = b'\x81\x92\xbchttps://git.example.com/0001\xa3git\x82\xc4\x07swhtype\xafscheduler_model\xc4\x01d\x89\xa3url\xbchttps:/...swhtype\xa8datetime\xc4\x01d\xd9 2021-01-20T11:53:14.951728+00:00\xadlast_snapshot\xc0\xa8__type__\xb0OriginVisitStats' extra_decoders = {'scheduler_model': <function <lambda> at 0x7fd10657b1e0>} def msgpack_loads(data: bytes, extra_decoders=None) -> Any: """Read data as a msgpack stream. .. Caution:: This function is used by swh.journal to decode the contents of the journal. This function **must** be kept backwards-compatible. """ decoders = get_decoders(extra_decoders) def ext_hook(code, data): if code == MsgpackExtTypeCodes.LONG_INT.value: return int.from_bytes(data, "big") elif code == MsgpackExtTypeCodes.LONG_NEG_INT.value: return -int.from_bytes(data, "big") raise ValueError("Unknown msgpack extended code %s" % code) def decode_types(obj): # Support for current encodings if set(obj.keys()) == {b"d", b"swhtype"}: decoder = decoders.get(obj[b"swhtype"]) if decoder: return decoder(obj[b"d"]) # Fallthrough return obj try: try: return msgpack.unpackb( data, raw=False, object_hook=decode_types, ext_hook=ext_hook, > strict_map_key=False, ) .tox/py3/lib/python3.7/site-packages/swh/core/api/serializers.py:292: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? E TypeError: unhashable type: 'list' msgpack/_unpacker.pyx:195: TypeError During handling of the above exception, another exception occurred: self = <swh.scheduler.tests.test_scheduler.TestScheduler object at 0x7fd10414c2b0> swh_scheduler = <RemoteScheduler url=mock://example.com/> listed_origins_by_type = {'git': [ListedOrigin(lister_id=UUID('757d0d38-3f23-42db-993f-af96b79b1d73'), url='https://git.example.com/0000', visi...etime(2020, 6, 15, 16, 0, 0, 1005, tzinfo=datetime.timezone.utc), enabled=True, first_seen=None, last_seen=None), ...]} policy = 'oldest_scheduled_first' @pytest.mark.parametrize("policy", ["oldest_scheduled_first"]) def test_grab_next_visits(self, swh_scheduler, listed_origins_by_type, policy): NUM_RESULTS = 5 # Strict inequality to check that grab_next_visits doesn't return more # results than requested visit_type = next(iter(listed_origins_by_type)) assert len(listed_origins_by_type[visit_type]) > NUM_RESULTS for origins in listed_origins_by_type.values(): swh_scheduler.record_listed_origins(origins) before = utcnow() ret = swh_scheduler.grab_next_visits(visit_type, NUM_RESULTS, policy=policy) after = utcnow() assert len(ret) == NUM_RESULTS for origin in ret: pk = (origin.url, origin.visit_type) > visit_stats = swh_scheduler.origin_visit_stats_get([pk])[pk] .tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_scheduler.py:748: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:181: in meth_ return self.post(meth._endpoint_path, post_data) .tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:278: in post return self._decode_response(response) .tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py:355: in _decode_response return decode_response(response, extra_decoders=self.extra_type_decoders) .tox/py3/lib/python3.7/site-packages/swh/core/api/serializers.py:120: in decode_response r = msgpack_loads(response.content, extra_decoders=extra_decoders) .tox/py3/lib/python3.7/site-packages/swh/core/api/serializers.py:296: in msgpack_loads data, raw=False, object_hook=decode_types, ext_hook=ext_hook _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? E ValueError: list is not allowed for map key msgpack/_unpacker.pyx:195: ValueError