From adc1670a54d270f2a17eff6898cc0931eabea450 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 16 Nov 2010 21:49:44 -0500 Subject: make some tests which previously failed on jython pass --- pyramid/tests/test_integration.py | 15 ++++++++++----- pyramid/tests/viewdecoratorapp/views/templates/foo.mak | 3 +++ pyramid/tests/viewdecoratorapp/views/templates/foo.pt | 3 --- pyramid/tests/viewdecoratorapp/views/views.py | 10 ++-------- 4 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 pyramid/tests/viewdecoratorapp/views/templates/foo.mak delete mode 100644 pyramid/tests/viewdecoratorapp/views/templates/foo.pt diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index e8d119e79..bc9d75d33 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -70,6 +70,11 @@ class TwillBase(unittest.TestCase): def setUp(self): import sys import twill + from twill.commands import config as twillconfig + # for benefit of Jython, which cannot import the subprocess module, we + # configure twill to not use tidy + twillconfig('use_tidy', False) + twillconfig('require_tidy', False) from pyramid.configuration import Configurator config = Configurator(root_factory=self.root_factory) config.load_zcml(self.config) @@ -79,7 +84,7 @@ class TwillBase(unittest.TestCase): else: out = open('/dev/null', 'wb') twill.set_output(out) - testing.setUp(registry=config.registry) + self.config = testing.setUp(registry=config.registry) def tearDown(self): import twill @@ -172,6 +177,10 @@ class TestRestBugApp(TwillBase): class TestViewDecoratorApp(TwillBase): config = 'pyramid.tests.viewdecoratorapp:configure.zcml' def test_it(self): + # we use mako here instead of chameleon because it works on Jython + tmpldir = os.path.join(os.path.dirname(__file__), 'viewdecoratorapp', + 'views') + self.config.registry.settings['mako.directories'] = tmpldir import twill.commands browser = twill.commands.get_browser() browser.go('http://localhost:6543/first') @@ -182,10 +191,6 @@ class TestViewDecoratorApp(TwillBase): self.assertEqual(browser.get_code(), 200) self.failUnless('OK2' in browser.get_html()) - browser.go('http://localhost:6543/third') - self.assertEqual(browser.get_code(), 200) - self.failUnless('OK3' in browser.get_html()) - class TestViewPermissionBug(TwillBase): # view_execution_permitted bug as reported by Shane at http://lists.repoze.org/pipermail/repoze-dev/2010-October/003603.html config = 'pyramid.tests.permbugapp:configure.zcml' diff --git a/pyramid/tests/viewdecoratorapp/views/templates/foo.mak b/pyramid/tests/viewdecoratorapp/views/templates/foo.mak new file mode 100644 index 000000000..6a2f701b6 --- /dev/null +++ b/pyramid/tests/viewdecoratorapp/views/templates/foo.mak @@ -0,0 +1,3 @@ + +${result} + diff --git a/pyramid/tests/viewdecoratorapp/views/templates/foo.pt b/pyramid/tests/viewdecoratorapp/views/templates/foo.pt deleted file mode 100644 index 6a2f701b6..000000000 --- a/pyramid/tests/viewdecoratorapp/views/templates/foo.pt +++ /dev/null @@ -1,3 +0,0 @@ - -${result} - diff --git a/pyramid/tests/viewdecoratorapp/views/views.py b/pyramid/tests/viewdecoratorapp/views/views.py index c59bc87ed..0b3147c86 100644 --- a/pyramid/tests/viewdecoratorapp/views/views.py +++ b/pyramid/tests/viewdecoratorapp/views/views.py @@ -1,17 +1,11 @@ -import os from pyramid.view import view_config -@view_config(renderer='templates/foo.pt', name='first') +@view_config(renderer='templates/foo.mak', name='first') def first(request): return {'result':'OK1'} -@view_config(renderer='pyramid.tests.viewdecoratorapp.views:templates/foo.pt', +@view_config(renderer='pyramid.tests.viewdecoratorapp.views:templates/foo.mak', name='second') def second(request): return {'result':'OK2'} -here = os.path.normpath(os.path.dirname(os.path.abspath(__file__))) -foo = os.path.join(here, 'templates', 'foo.pt') -@view_config(renderer=foo, name='third') -def third(request): - return {'result':'OK3'} -- cgit v1.2.3