conftest.py 690 B

1234567891011121314151617181920212223242526272829
  1. import pickle
  2. import pytest
  3. from multidict._compat import USE_EXTENSIONS
  4. OPTIONAL_CYTHON = (
  5. ()
  6. if USE_EXTENSIONS
  7. else pytest.mark.skip(reason="No extensions available")
  8. )
  9. @pytest.fixture( # type: ignore[call-overload]
  10. scope="session",
  11. params=[
  12. pytest.param("multidict._multidict", marks=OPTIONAL_CYTHON), # type: ignore
  13. "multidict._multidict_py",
  14. ],
  15. )
  16. def _multidict(request):
  17. return pytest.importorskip(request.param)
  18. def pytest_generate_tests(metafunc):
  19. if "pickle_protocol" in metafunc.fixturenames:
  20. metafunc.parametrize(
  21. "pickle_protocol", list(range(pickle.HIGHEST_PROTOCOL + 1)), scope="session"
  22. )