diff options
| author | Chris McDonough <chrism@plope.com> | 2010-11-16 21:49:44 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-11-16 21:49:44 -0500 |
| commit | adc1670a54d270f2a17eff6898cc0931eabea450 (patch) | |
| tree | 9969c85c6197e2aa8e4858b4662244ce3077b9cd | |
| parent | 327b51fe1f1160b98289070c181b088addc16dd0 (diff) | |
| download | pyramid-adc1670a54d270f2a17eff6898cc0931eabea450.tar.gz pyramid-adc1670a54d270f2a17eff6898cc0931eabea450.tar.bz2 pyramid-adc1670a54d270f2a17eff6898cc0931eabea450.zip | |
make some tests which previously failed on jython pass
| -rw-r--r-- | pyramid/tests/test_integration.py | 15 | ||||
| -rw-r--r-- | pyramid/tests/viewdecoratorapp/views/templates/foo.mak (renamed from pyramid/tests/viewdecoratorapp/views/templates/foo.pt) | 0 | ||||
| -rw-r--r-- | pyramid/tests/viewdecoratorapp/views/views.py | 10 |
3 files changed, 12 insertions, 13 deletions
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.pt b/pyramid/tests/viewdecoratorapp/views/templates/foo.mak index 6a2f701b6..6a2f701b6 100644 --- a/pyramid/tests/viewdecoratorapp/views/templates/foo.pt +++ b/pyramid/tests/viewdecoratorapp/views/templates/foo.mak 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'} |
