Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/pytest_plugin.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2021 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from collections import defaultdict | from collections import defaultdict | ||||
import random | import random | ||||
import string | import string | ||||
from typing import Any, Collection, Dict, Iterator, Optional | from typing import Any, Collection, Dict, Iterator, Optional | ||||
import attr | import attr | ||||
from confluent_kafka import Consumer, KafkaException, Producer | from confluent_kafka import Consumer, KafkaException, Producer | ||||
from confluent_kafka.admin import AdminClient | from confluent_kafka.admin import AdminClient | ||||
import pytest | import pytest | ||||
from swh.journal.serializers import kafka_to_key, kafka_to_value, pprint_key | from swh.journal.serializers import kafka_to_key, kafka_to_value, pprint_key | ||||
from swh.journal.tests.journal_data import TEST_OBJECTS | from swh.model.tests.swh_model_data import TEST_OBJECTS | ||||
def ensure_lists(value: Any) -> Any: | def ensure_lists(value: Any) -> Any: | ||||
""" | """ | ||||
>>> ensure_lists(["foo", 42]) | >>> ensure_lists(["foo", 42]) | ||||
['foo', 42] | ['foo', 42] | ||||
>>> ensure_lists(("foo", 42)) | >>> ensure_lists(("foo", 42)) | ||||
['foo', 42] | ['foo', 42] | ||||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |