blob: 37b2d14a395f5c27ed608955860471d597e2ae3d (
about) (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
import pytest
from mako.ext.beaker_cache import has_beaker
from mako.util import update_wrapper
try:
import babel.messages.extract as babel
except ImportError:
babel = None
try:
import lingua
except ImportError:
lingua = None
try:
import dogpile.cache # noqa
except ImportError:
has_dogpile_cache = False
else:
has_dogpile_cache = True
requires_beaker = pytest.mark.skipif(
not has_beaker, reason="Beaker is required for these tests."
)
requires_babel = pytest.mark.skipif(
babel is None, reason="babel not installed: skipping babelplugin test"
)
requires_lingua = pytest.mark.skipif(
lingua is None, reason="lingua not installed: skipping linguaplugin test"
)
requires_dogpile_cache = pytest.mark.skipif(
not has_dogpile_cache,
reason="dogpile.cache is required to run these tests",
)
def _pygments_version():
try:
import pygments
version = pygments.__version__
except:
version = "0"
return version
requires_pygments_14 = pytest.mark.skipif(
_pygments_version() < "1.4", reason="Requires pygments 1.4 or greater"
)
# def requires_pygments_14(fn):
# return skip_if(
# lambda: version < "1.4", "Requires pygments 1.4 or greater"
# )(fn)
def requires_no_pygments_exceptions(fn):
def go(*arg, **kw):
from mako import exceptions
exceptions._install_fallback()
try:
return fn(*arg, **kw)
finally:
exceptions._install_highlighting()
return update_wrapper(go, fn)
|