Skip to content
Myr

Merge branch '2.7-maintenance'

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

authored by Armin Ronacher · committed by Armin Ronacher · parents 4c7b51b, 3d82fc3 · Browse files · 4 files+42 added−3 removed
This commit

State

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

Diff stats

4 files+42 added−3 removed

  • other:+42 added−3 removed

4 files+42 added−3 removed

modified:jinja2/testsuite/__init__.py+2 added-1 removed
121 unmodified lines
122123def suite():124 from jinja2.testsuite import ext, filters, tests, core_tags, \125 loader, inheritance, imports, lexnparse, security, api, \126 regression, debug, utils, doctests126 regression, debug, utils, bytecode_cache, doctests127 suite = unittest.TestSuite()128 suite.addTest(ext.suite())129 suite.addTest(filters.suite())130 suite.addTest(tests.suite())
6 unmodified lines
137 suite.addTest(api.suite())138 suite.addTest(regression.suite())139 suite.addTest(debug.suite())140 suite.addTest(utils.suite())141 suite.addTest(bytecode_cache.suite())142143 # doctests will not run on python 3 currently. Too many issues144 # with that, do not test that on that platform.145 if PY2:
11 unmodified lines
added:jinja2/testsuite/bytecode_cache.py+37 added
1# -*- coding: utf-8 -*-2"""3 jinja2.testsuite.bytecode_cache4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~56 Test bytecode caching78 :copyright: (c) 2010 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""11import unittest1213from jinja2.testsuite import JinjaTestCase, package_loader1415from jinja2 import Environment16from jinja2.bccache import FileSystemBytecodeCache17from jinja2.exceptions import TemplateNotFound1819bytecode_cache = FileSystemBytecodeCache()20env = Environment(21 loader=package_loader,22 bytecode_cache=bytecode_cache,23)242526class ByteCodeCacheTestCase(JinjaTestCase):2728 def test_simple(self):29 tmpl = env.get_template('test.html')30 assert tmpl.render().strip() == 'BAR'31 self.assert_raises(TemplateNotFound, env.get_template, 'missing.html')323334def suite():35 suite = unittest.TestSuite()36 suite.addTest(unittest.makeSuite(ByteCodeCacheTestCase))37 return suite
modified:jinja2/bccache.py+2 added-2 removed
19 unmodified lines
20import tempfile21import fnmatch22from hashlib import sha123from jinja2.utils import open_if_exists24from jinja2._compat import BytesIO, pickle, PY224from jinja2._compat import BytesIO, pickle, PY2, text_type252627# marshal works better on 3.x, one hack less required28if not PY2:
130 unmodified lines
159 """Returns the unique hash key for this template name."""160 hash = sha1(name.encode('utf-8'))161 if filename is not None:162 filename = '|' + filename163 if isinstance(filename, unicode):163 if isinstance(filename, text_type):164 filename = filename.encode('utf-8')165 hash.update(filename)166 return hash.hexdigest()167
144 unmodified lines
modified:CHANGES+1 added
5 unmodified lines
6(bugfix release)78- Fixed a bug with ``call_filter`` not working properly on environment9 and context filters.10- Fixed lack of Python 3 support for bytecode caches.1112Version 2.713-----------14(codename Translation, released on May 20th 2013)
294 unmodified lines