Skip to content
Myr

Merge pull request #738 from davidism/test-config

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

Standard test config

authored by David Lord · committed by GitHub · parents 3ff8ec7, 8261ac0 · Browse files · 9 files+86 added−40 removed
This commit

State

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

Diff stats

9 files+86 added−40 removed

  • tests:+0 added−18 removed
  • other:+86 added−22 removed

9 files+86 added−40 removed

modified:docs/extensions.rst+3 added-3 removed
25 unmodified lines
26--------------2728**Import name:** `jinja2.ext.i18n`2930The i18n extension can be used in combination with `gettext`_ or `babel`_. If 31the i18n extension is enabled Jinja2 provides a `trans` statement that marks 30The i18n extension can be used in combination with `gettext`_ or `babel`_. If31the i18n extension is enabled Jinja2 provides a `trans` statement that marks32the wrapped string as translatable and calls `gettext`.3334After enabling, dummy `_` function that forwards calls to `gettext` is added35to the environment globals. An internationalized application then has to
266 unmodified lines
302303 The current :class:`~jinja2.lexer.TokenStream`304305.. autoclass:: jinja2.lexer.TokenStream306 :members: push, look, eos, skip, next, next_if, skip_if, expect306 :members: push, look, eos, skip, __next__, next_if, skip_if, expect307308 .. attribute:: current309310 The current :class:`~jinja2.lexer.Token`.
40 unmodified lines
modified:docs/templates.rst+7 added-5 removed
195 unmodified lines
196197gets rendered with blank lines inside the div::198199 <div>200 200201 yay202 202203 </div>204205But with both `trim_blocks` and `lstrip_blocks` enabled, the template block206lines are removed and other whitespace is preserved::207 207208 <div>209 yay210 </div>211
309 unmodified lines
521Working with Automatic Escaping522~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~523524When automatic escaping is enabled, everything is escaped by default except525for values explicitly marked as safe. Variables and expressions 525for values explicitly marked as safe. Variables and expressions526can be marked as safe either in:527528a. the context dictionary by the application with `MarkupSafe.Markup`, or529b. the template, with the `|safe` filter530 530531The main problem with this approach is that Python itself doesn't have the532concept of tainted values; so whether a value is safe or unsafe can get lost.533534If a value is not marked safe, auto-escaping will take place; which means that
764 unmodified lines
12991300The `else` part is optional. If not provided, the else block implicitly1301evaluates into an undefined object::13021303.. sourcecode:: jinja13041305 {{ '[%s]' % page.title if page.title }}130613071308.. _builtin-filters:
350 unmodified lines
modified:jinja2/lexer.py+4 added-1 removed
345 unmodified lines
346 """Like :meth:`next_if` but only returns `True` or `False`."""347 return self.next_if(expr) is not None348349 def __next__(self):350 """Go one token ahead and return the old one"""350 """Go one token ahead and return the old one.351352 Use the built-in :func:`next` instead of calling this directly.353 """354 rv = self.current355 if self._pushed:356 self.current = self._pushed.popleft()357 elif self.current.type is not TOKEN_EOF:
382 unmodified lines
modified:tests/test_utils.py-18 removed
74 unmodified lines
75 assert func('FOO.TXT') == False767778@pytest.mark.utils79@pytest.mark.markupleak80@pytest.mark.skipif(hasattr(escape, 'func_code'),81 reason='this test only tests the c extension')82class TestMarkupLeak(object):8384 def test_markup_leaks(self):85 counts = set()86 for count in range(20):87 for item in range(1000):88 escape("foo")89 escape("<foo>")90 escape(u"foo")91 escape(u"<foo>")92 counts.add(len(gc.get_objects()))93 assert len(counts) == 1, 'ouch, c extension seems to leak objects'949596@pytest.mark.utils79@pytest.mark.escapeUrlizeTarget80class TestEscapeUrlizeTarget(object):81 def test_escape_urlize_target(self):82 url = "http://example.org"
4 unmodified lines
added:.coveragerc+11 added
1[run]2branch = True3source =4 jinja25 tests67[paths]8source =9 jinja210 .tox/*/lib/python*/site-packages/jinja211 .tox/pypy/site-packages/jinja2
modified:.gitignore+3 added
10 unmodified lines
11.cache/12.idea/13venv/14venv-*/15.coverage16.coverage.*17htmlcov
modified:.travis.yml+21 added-8 removed
modified:setup.cfg+2 added-1 removed
3 unmodified lines
4[metadata]5license_file = LICENSE67[tool:pytest]8norecursedirs = .* *.egg *.egg-info env* artwork docs examples venv*8minversion = 3.09testpaths = tests
modified:tox.ini+35 added-4 removed
1[tox]2envlist = py26,py27,pypy,py33,py34,py35,py362envlist =3 py{36,35,34,33,27,26,py}4 docs-html5 coverage-report67[testenv]5commands = py.test {posargs}68passenv = LANG9usedevelop = true10deps =8 pytest11 pytest>=312 coverage1314commands = coverage run -p -m pytest {posargs}1516[testenv:docs-html]17deps = sphinx18commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html1920[testenv:docs-linkcheck]21deps = sphinx22commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck2324[testenv:coverage-report]25deps = coverage26skip_install = true27commands =28 coverage combine29 coverage report30 coverage html3132[testenv:codecov]33passenv = CI TRAVIS TRAVIS_*34deps = codecov35skip_install = true36commands =37 coverage combine38 coverage report39 codecov