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
Provenance
- Commit
05b55d5- Tree
8a1ce68- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
3ff8ec7- Parent 2
8261ac0
9 files changed+86 added−40 removed
modified:docs/extensions.rst+3 added-3 removed
25 unmodified lines26 --------------27 28 **Import name:** `jinja2.ext.i18n`29 30-The i18n extension can be used in combination with `gettext`_ or `babel`_. If 31-the i18n extension is enabled Jinja2 provides a `trans` statement that marks 30+The i18n extension can be used in combination with `gettext`_ or `babel`_. If31+the i18n extension is enabled Jinja2 provides a `trans` statement that marks32 the wrapped string as translatable and calls `gettext`.33 34 After enabling, dummy `_` function that forwards calls to `gettext` is added35 to the environment globals. An internationalized application then has to266 unmodified lines302 303 The current :class:`~jinja2.lexer.TokenStream`304 305 .. 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, expect307 308 .. attribute:: current309 310 The current :class:`~jinja2.lexer.Token`.40 unmodified linesmodified:docs/templates.rst+7 added-5 removed
195 unmodified lines196 197 gets rendered with blank lines inside the div::198 199 <div>200- 200+201 yay202- 202+203 </div>204 205 But with both `trim_blocks` and `lstrip_blocks` enabled, the template block206 lines are removed and other whitespace is preserved::207- 207+208 <div>209 yay210 </div>211 309 unmodified lines521 Working with Automatic Escaping522 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~523 524 When automatic escaping is enabled, everything is escaped by default except525-for values explicitly marked as safe. Variables and expressions 525+for values explicitly marked as safe. Variables and expressions526 can be marked as safe either in:527 528 a. the context dictionary by the application with `MarkupSafe.Markup`, or529 b. the template, with the `|safe` filter530- 530+531 The main problem with this approach is that Python itself doesn't have the532 concept of tainted values; so whether a value is safe or unsafe can get lost.533 534 If a value is not marked safe, auto-escaping will take place; which means that764 unmodified lines1299 1300 The `else` part is optional. If not provided, the else block implicitly1301 evaluates into an undefined object::1302 1303+.. sourcecode:: jinja1304+1305 {{ '[%s]' % page.title if page.title }}1306 1307 1308 .. _builtin-filters:350 unmodified linesmodified:jinja2/lexer.py+4 added-1 removed
345 unmodified lines346 """Like :meth:`next_if` but only returns `True` or `False`."""347 return self.next_if(expr) is not None348 349 def __next__(self):350- """Go one token ahead and return the old one"""350+ """Go one token ahead and return the old one.351+352+ 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 linesmodified:tests/test_utils.py-18 removed
74 unmodified lines75 assert func('FOO.TXT') == False76 77 78 @pytest.mark.utils79-@pytest.mark.markupleak80-@pytest.mark.skipif(hasattr(escape, 'func_code'),81- reason='this test only tests the c extension')82-class TestMarkupLeak(object):83-84- 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'94-95-96-@pytest.mark.utils79 @pytest.mark.escapeUrlizeTarget80 class TestEscapeUrlizeTarget(object):81 def test_escape_urlize_target(self):82 url = "http://example.org"4 unmodified linesadded:.coveragerc+11 added
1+[run]2+branch = True3+source =4+ jinja25+ tests6+7+[paths]8+source =9+ jinja210+ .tox/*/lib/python*/site-packages/jinja211+ .tox/pypy/site-packages/jinja2modified:.gitignore+3 added
10 unmodified lines11 .cache/12 .idea/13 venv/14 venv-*/15+.coverage16+.coverage.*17+htmlcovmodified:.travis.yml+21 added-8 removed
123456567891011891011121314151617181920212223242526172728293031323334353637383940284142434445sudo: falselanguage: python
python: - "2.6" - "2.7" - 3.6 - 3.5 - 3.4 - 3.3 - 2.7 - 2.6 - pypy - "3.3" - "3.4" - "3.5" - "3.6"
env: - TOXENV=py,codecov
matrix: include: - python: nightly env: TOXENV=py - python: 3.6 env: TOXENV=docs-html
install: - pip install tox
script: - tox -e py - tox
cache: - pip
branches: only: - master - /^.*-maintenance$/
notifications: email: false irc: channels: - chat.freenode.net#pocoo - "chat.freenode.net#pocoo" on_success: change on_failure: always use_notice: true skip_join: truemodified:setup.cfg+2 added-1 removed
3 unmodified lines4 [metadata]5 license_file = LICENSE6 7 [tool:pytest]8-norecursedirs = .* *.egg *.egg-info env* artwork docs examples venv*8+minversion = 3.09+testpaths = testsmodified:tox.ini+35 added-4 removed
1 [tox]2-envlist = py26,py27,pypy,py33,py34,py35,py362+envlist =3+ py{36,35,34,33,27,26,py}4+ docs-html5+ coverage-report6 7 [testenv]5-commands = py.test {posargs}6-8+passenv = LANG9+usedevelop = true10 deps =8- pytest11+ pytest>=312+ coverage13+14+commands = coverage run -p -m pytest {posargs}15+16+[testenv:docs-html]17+deps = sphinx18+commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html19+20+[testenv:docs-linkcheck]21+deps = sphinx22+commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck23+24+[testenv:coverage-report]25+deps = coverage26+skip_install = true27+commands =28+ coverage combine29+ coverage report30+ coverage html31+32+[testenv:codecov]33+passenv = CI TRAVIS TRAVIS_*34+deps = codecov35+skip_install = true36+commands =37+ coverage combine38+ coverage report39+ codecov