data = b'\x81\x92\xbbhttps://github.com/666/test\xa3git\x82\xc4\x07swhtype\xafscheduler_model\xc4\x01d\x89\xa3url\xbbhttps://...adlast_snapshot\xc4\x14\xd8\x1c\xc0q\x0e\xb6\xcf\x9e\xfd[\x92\n\x84S\xe1\xe0qW\xb6\xcd\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 0x7fd0ffff7b70>
swh_scheduler = <RemoteScheduler url=mock://example.com/>
def test_origin_visit_stats_upsert_with_snapshot(self, swh_scheduler) -> None:
eventful_date = utcnow()
url = "https://github.com/666/test"
visit_stats = OriginVisitStats(
url=url,
visit_type="git",
last_eventful=eventful_date,
last_uneventful=None,
last_failed=None,
last_notfound=None,
last_snapshot=hash_to_bytes("d81cc0710eb6cf9efd5b920a8453e1e07157b6cd"),
)
swh_scheduler.origin_visit_stats_upsert([visit_stats])
> assert swh_scheduler.origin_visit_stats_get([(url, "git")]) == {
(url, "git"): visit_stats
}
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_scheduler.py:862:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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
TEST RESULT
TEST RESULT
- Run At
- Jan 20 2021, 12:53 PM