Skip to content
Myr

ensure deprecation warnings mention version

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent bb6216e · Browse files · 6 files+19 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+19 added−13 removed

  • tests:+0 added−4 removed
  • other:+19 added−9 removed

6 files+19 added−13 removed

modified:src/jinja2/environment.py+7 added-2 removed
725 unmodified lines
726 pass727728 if py_compile:729 if not PY2 or PYPY:730 from warnings import warn730 import warnings731732 warn(Warning("py_compile has no effect on pypy or Python 3"))732 warnings.warn(733 "'py_compile=True' has no effect on PyPy or Python"734 " 3 and will be removed in version 3.0",735 DeprecationWarning,736 stacklevel=2,737 )738 py_compile = False739 else:740 import imp741 import marshal
626 unmodified lines
modified:src/jinja2/filters.py+7 added-4 removed
14 unmodified lines
15from collections import namedtuple16from itertools import chain17from itertools import groupby1819from markupsafe import escape20from markupsafe import Markup21from markupsafe import soft_unicode2223from ._compat import abc24from ._compat import imap25from ._compat import iteritems26from ._compat import string_types27from ._compat import text_type28from .exceptions import FilterArgumentError29from .runtime import Undefined26from .utils import escape30from .utils import htmlsafe_json_dumps28from .utils import Markup31from .utils import pformat30from .utils import soft_unicode32from .utils import unicode_urlencode33from .utils import urlize3435_word_re = re.compile(r"\w+", re.UNICODE)
603 unmodified lines
639 Rename the ``indentfirst`` argument to ``first``.640 """641 if indentfirst is not None:642 warnings.warn(642 DeprecationWarning('The "indentfirst" argument is renamed to "first".'),643 "The 'indentfirst' argument is renamed to 'first' and will"644 " be removed in version 3.0.",645 DeprecationWarning,646 stacklevel=2,647 )648 first = indentfirst649
741 unmodified lines
modified:src/jinja2/sandbox.py+1 added-2 removed
57 unmodified lines
58UNSAFE_ASYNC_GENERATOR_ATTRIBUTES = {"ag_code", "ag_frame"}5960# make sure we don't warn in python 2.6 about stuff we don't care about61warnings.filterwarnings(62 "ignore", "the sets module", DeprecationWarning, module="jinja2.sandbox"62 "ignore", "the sets module", DeprecationWarning, module=__name__63)6465_mutable_set_types = (set,)66_mutable_mapping_types = (dict,)67_mutable_sequence_types = (list,)686969# on python 2.x we can register the user collection types70try:71 from UserDict import UserDict, DictMixin72 from UserList import UserList
448 unmodified lines
modified:tests/test_filters.py-4 removed
194 unmodified lines
195 Tests cases where the filter input is a Markup type196 """197 self._test_indent_multiline_template(env, markup=True)198199 def test_indentfirst_deprecated(self, env):200 with pytest.warns(DeprecationWarning):201 env.from_string('{{ "jinja"|indent(indentfirst=true) }}').render()202199 @pytest.mark.parametrize(200 ("value", "expect"),201 (202 ("42", "42"),
552 unmodified lines
modified:setup.cfg+3 added
4 unmodified lines
5universal = true67[tool:pytest]8testpaths = tests9filterwarnings =10 error11 ignore:the sets module:DeprecationWarning:jinja2.sandbox1213[coverage:run]14branch = True15source =
30 unmodified lines
modified:tox.ini+1 added-1 removed
7 unmodified lines
8[testenv]9deps =10 coverage11 pytest12commands = coverage run -p -m pytest --tb=short -Werror --basetemp={envtmpdir} {posargs}12commands = coverage run -p -m pytest --tb=short --basetemp={envtmpdir} {posargs}1314[testenv:docs-html]15deps =16 Sphinx
20 unmodified lines