diff --git a/swh/journal/pytest_plugin.py b/swh/journal/pytest_plugin.py --- a/swh/journal/pytest_plugin.py +++ b/swh/journal/pytest_plugin.py @@ -83,10 +83,14 @@ del value["ctime"] for key in known_keys: - assert key in received_keys, ( - f"expected {object_type} key {hash_to_hex(key)} " - "absent from consumed messages" - ) + try: + key_str = hash_to_hex(key) + except TypeError: + key_str = repr(key) + + assert ( + key in received_keys + ), f"expected {object_type} key {key_str} absent from consumed messages" if exclude and object_type in exclude: continue