conftest.py 647 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import pytest
  2. from markupsafe import _native
  3. try:
  4. from markupsafe import _speedups
  5. except ImportError:
  6. _speedups = None
  7. @pytest.fixture(
  8. scope="session",
  9. params=(
  10. _native,
  11. pytest.param(
  12. _speedups,
  13. marks=pytest.mark.skipif(_speedups is None, reason="speedups unavailable"),
  14. ),
  15. ),
  16. )
  17. def _mod(request):
  18. return request.param
  19. @pytest.fixture(scope="session")
  20. def escape(_mod):
  21. return _mod.escape
  22. @pytest.fixture(scope="session")
  23. def escape_silent(_mod):
  24. return _mod.escape_silent
  25. @pytest.fixture(scope="session")
  26. def soft_str(_mod):
  27. return _mod.soft_unicode