aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/multidict/tests/conftest.py
blob: bd3b4de027f4b0c0e462b4f9dba7abc9fcfe3b3b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pickle

import pytest

from multidict._compat import USE_EXTENSIONS

OPTIONAL_CYTHON = (
    ()
    if USE_EXTENSIONS
    else pytest.mark.skip(reason="No extensions available")
)


@pytest.fixture(  # type: ignore[call-overload]
    scope="session",
    params=[
        pytest.param("multidict._multidict", marks=OPTIONAL_CYTHON),  # type: ignore
        "multidict._multidict_py",
    ],
)
def _multidict(request):
    return pytest.importorskip(request.param)


def pytest_generate_tests(metafunc):
    if "pickle_protocol" in metafunc.fixturenames:
        metafunc.parametrize(
            "pickle_protocol", list(range(pickle.HIGHEST_PROTOCOL + 1)), scope="session"
        )