summaryrefslogtreecommitdiff
path: root/tests/conftest.py
blob: f05285de8bb590ca403b22f868d25890c3bc8f31 (plain)
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
30
31
32
33
34
35
36
37
import pytest

from markupsafe import _native

try:
    from markupsafe import _rust_speedups as _speedups
except ImportError:
    _speedups = None  # type: ignore


@pytest.fixture(
    scope="session",
    params=(
        _native,
        pytest.param(
            _speedups,
            marks=pytest.mark.skipif(_speedups is None, reason="speedups unavailable"),
        ),
    ),
)
def _mod(request):
    return request.param


@pytest.fixture(scope="session")
def escape(_mod):
    return _mod.escape


@pytest.fixture(scope="session")
def escape_silent(_mod):
    return _mod.escape_silent


@pytest.fixture(scope="session")
def soft_str(_mod):
    return _mod.soft_str