[tool:pytest]
testpaths = tests
+filterwarnings =
+ error
+ ignore:the sets module:DeprecationWarning:jinja2.sandbox
[coverage:run]
branch = True
if py_compile:
if not PY2 or PYPY:
- from warnings import warn
+ import warnings
- warn(Warning("py_compile has no effect on pypy or Python 3"))
+ warnings.warn(
+ "'py_compile=True' has no effect on PyPy or Python"
+ " 3 and will be removed in version 3.0",
+ DeprecationWarning,
+ stacklevel=2,
+ )
py_compile = False
else:
import imp
from itertools import chain
from itertools import groupby
+from markupsafe import escape
+from markupsafe import Markup
+from markupsafe import soft_unicode
+
from ._compat import abc
from ._compat import imap
from ._compat import iteritems
from ._compat import text_type
from .exceptions import FilterArgumentError
from .runtime import Undefined
-from .utils import escape
from .utils import htmlsafe_json_dumps
-from .utils import Markup
from .utils import pformat
-from .utils import soft_unicode
from .utils import unicode_urlencode
from .utils import urlize
"""
if indentfirst is not None:
warnings.warn(
- DeprecationWarning('The "indentfirst" argument is renamed to "first".'),
+ "The 'indentfirst' argument is renamed to 'first' and will"
+ " be removed in version 3.0.",
+ DeprecationWarning,
stacklevel=2,
)
first = indentfirst
# make sure we don't warn in python 2.6 about stuff we don't care about
warnings.filterwarnings(
- "ignore", "the sets module", DeprecationWarning, module="jinja2.sandbox"
+ "ignore", "the sets module", DeprecationWarning, module=__name__
)
_mutable_set_types = (set,)
_mutable_mapping_types = (dict,)
_mutable_sequence_types = (list,)
-
# on python 2.x we can register the user collection types
try:
from UserDict import UserDict, DictMixin
"""
self._test_indent_multiline_template(env, markup=True)
- def test_indentfirst_deprecated(self, env):
- with pytest.warns(DeprecationWarning):
- env.from_string('{{ "jinja"|indent(indentfirst=true) }}').render()
-
@pytest.mark.parametrize(
("value", "expect"),
(
deps =
coverage
pytest
-commands = coverage run -p -m pytest --tb=short -Werror --basetemp={envtmpdir} {posargs}
+commands = coverage run -p -m pytest --tb=short --basetemp={envtmpdir} {posargs}
[testenv:docs-html]
deps =