Permalink
Browse files

Added test to test #18 which shows that issue 18 is not valid

  • Loading branch information...
1 parent 2e2f99e commit b60c4d8563befa75b7b014d47ca2d8d8b002b711 @rockyburt rockyburt committed Feb 18, 2011
@@ -0,0 +1 @@
+bar
@@ -0,0 +1 @@
+foo
@@ -316,6 +316,40 @@ def test_uptodate(self):
assert fi.uptodate() is False
+class TestJinja2SearchPathIntegration(unittest.TestCase):
+
+ def test_it(self):
+ from pyramid.config import Configurator
+ from pyramid_jinja2 import includeme
+ from webtest import TestApp
+ import os
+
+ here = os.path.abspath(os.path.dirname(__file__))
+ templates_dir = os.path.join(here, 'templates')
+
+ def myview(request):
+ return {}
+
+ config1 = Configurator(settings={
+ 'jinja2.directories': os.path.join(templates_dir, 'foo')})
+ includeme(config1)
+ config1.add_view(view=myview, renderer='mytemplate.jinja2')
+ config2 = Configurator(settings={
+ 'jinja2.directories': os.path.join(templates_dir, 'bar')})
+ includeme(config2)
+ config2.add_view(view=myview, renderer='mytemplate.jinja2')
+ self.assertNotEqual(config1.registry.settings,
+ config2.registry.settings)
+
+ app1 = config1.make_wsgi_app()
+ testapp = TestApp(app1)
+ self.assertEqual(testapp.get('/').body, 'foo')
+
+ app2 = config2.make_wsgi_app()
+ testapp = TestApp(app2)
+ self.assertEqual(testapp.get('/').body, 'bar')
+
+
class DummyEnvironment(object):
def get_template(self, path):
self.path = path
View
@@ -20,6 +20,12 @@
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+requires = [
+ 'pyramid>=1.0a10',
+ 'pyramid_zcml',
+ 'Jinja2'
+]
+
setup(name='pyramid_jinja2',
version='0.6',
description='Jinja2 template bindings for the Pyramid web framework',
@@ -38,8 +44,8 @@
packages=find_packages(),
include_package_data=True,
zip_safe=False,
- tests_require=['pyramid>=1.0a10', 'pyramid_zcml', 'Jinja2'],
- install_requires=['pyramid>=1.0a10', 'pyramid_zcml', 'Jinja2'],
+ tests_require=requires + ['WebTest'],
+ install_requires=requires,
test_suite="pyramid_jinja2",
entry_points="""
[paste.paster_create_template]

0 comments on commit b60c4d8

Please sign in to comment.