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
Provenance
- Commit
963b5d3- Tree
44a8d96- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
bb6216e
6 files changed+19 added−13 removed
modified:src/jinja2/environment.py+7 added-2 removed
725 unmodified lines726 pass727 728 if py_compile:729 if not PY2 or PYPY:730- from warnings import warn730+ import warnings731 732- 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 marshal626 unmodified linesmodified:src/jinja2/filters.py+7 added-4 removed
14 unmodified lines15 from collections import namedtuple16 from itertools import chain17 from itertools import groupby18 19+from markupsafe import escape20+from markupsafe import Markup21+from markupsafe import soft_unicode22+23 from ._compat import abc24 from ._compat import imap25 from ._compat import iteritems26 from ._compat import string_types27 from ._compat import text_type28 from .exceptions import FilterArgumentError29 from .runtime import Undefined26-from .utils import escape30 from .utils import htmlsafe_json_dumps28-from .utils import Markup31 from .utils import pformat30-from .utils import soft_unicode32 from .utils import unicode_urlencode33 from .utils import urlize34 35 _word_re = re.compile(r"\w+", re.UNICODE)603 unmodified lines639 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 linesmodified:src/jinja2/sandbox.py+1 added-2 removed
57 unmodified lines58 UNSAFE_ASYNC_GENERATOR_ATTRIBUTES = {"ag_code", "ag_frame"}59 60 # make sure we don't warn in python 2.6 about stuff we don't care about61 warnings.filterwarnings(62- "ignore", "the sets module", DeprecationWarning, module="jinja2.sandbox"62+ "ignore", "the sets module", DeprecationWarning, module=__name__63 )64 65 _mutable_set_types = (set,)66 _mutable_mapping_types = (dict,)67 _mutable_sequence_types = (list,)68 69-69 # on python 2.x we can register the user collection types70 try:71 from UserDict import UserDict, DictMixin72 from UserList import UserList448 unmodified linesmodified:tests/test_filters.py-4 removed
194 unmodified lines195 Tests cases where the filter input is a Markup type196 """197 self._test_indent_multiline_template(env, markup=True)198 199- def test_indentfirst_deprecated(self, env):200- with pytest.warns(DeprecationWarning):201- env.from_string('{{ "jinja"|indent(indentfirst=true) }}').render()202-199 @pytest.mark.parametrize(200 ("value", "expect"),201 (202 ("42", "42"),552 unmodified linesmodified:setup.cfg+3 added
4 unmodified lines5 universal = true6 7 [tool:pytest]8 testpaths = tests9+filterwarnings =10+ error11+ ignore:the sets module:DeprecationWarning:jinja2.sandbox12 13 [coverage:run]14 branch = True15 source =30 unmodified linesmodified:tox.ini+1 added-1 removed
7 unmodified lines8 [testenv]9 deps =10 coverage11 pytest12-commands = coverage run -p -m pytest --tb=short -Werror --basetemp={envtmpdir} {posargs}12+commands = coverage run -p -m pytest --tb=short --basetemp={envtmpdir} {posargs}13 14 [testenv:docs-html]15 deps =16 Sphinx20 unmodified lines