diff options
| author | Chris McDonough <chrism@plope.com> | 2013-05-21 17:58:40 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-05-21 17:58:40 -0400 |
| commit | 81c75fd1662b5b0a91616289dc44c808bb9be01a (patch) | |
| tree | 2805dcec5410dc22dfd692aa1257de357fcdd0eb | |
| parent | 83f34df6fcf7c43ec2357eee5d777baebd602581 (diff) | |
| download | pyramid-81c75fd1662b5b0a91616289dc44c808bb9be01a.tar.gz pyramid-81c75fd1662b5b0a91616289dc44c808bb9be01a.tar.bz2 pyramid-81c75fd1662b5b0a91616289dc44c808bb9be01a.zip | |
skip mako-related tests on py32
| -rw-r--r-- | pyramid/mako_templating.py | 1 | ||||
| -rw-r--r-- | pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.pt (renamed from pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.mak) | 0 | ||||
| -rw-r--r-- | pyramid/tests/pkgs/viewdecoratorapp/views/views.py | 4 | ||||
| -rw-r--r-- | pyramid/tests/test_integration.py | 10 | ||||
| -rw-r--r-- | pyramid/tests/test_mako_templating.py | 23 |
5 files changed, 20 insertions, 18 deletions
diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index 5fbdd002e..69b48a3b5 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -1,6 +1,5 @@ import os import posixpath -import re import sys import threading diff --git a/pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.mak b/pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.pt index 6a2f701b6..6a2f701b6 100644 --- a/pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.mak +++ b/pyramid/tests/pkgs/viewdecoratorapp/views/templates/foo.pt diff --git a/pyramid/tests/pkgs/viewdecoratorapp/views/views.py b/pyramid/tests/pkgs/viewdecoratorapp/views/views.py index 6f7ff1e21..2b7d7e928 100644 --- a/pyramid/tests/pkgs/viewdecoratorapp/views/views.py +++ b/pyramid/tests/pkgs/viewdecoratorapp/views/views.py @@ -1,11 +1,11 @@ from pyramid.view import view_config -@view_config(renderer='templates/foo.mak', name='first') +@view_config(renderer='templates/foo.pt', name='first') def first(request): return {'result':'OK1'} @view_config( - renderer='pyramid.tests.pkgs.viewdecoratorapp.views:templates/foo.mak', + renderer='pyramid.tests.pkgs.viewdecoratorapp.views:templates/foo.pt', name='second') def second(request): return {'result':'OK2'} diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index c8418c61d..66205e618 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -369,22 +369,12 @@ class TestForbiddenAppHasResult(IntegrationBase, unittest.TestCase): class TestViewDecoratorApp(IntegrationBase, unittest.TestCase): package = 'pyramid.tests.pkgs.viewdecoratorapp' - def _configure_mako(self): - tmpldir = os.path.join(os.path.dirname(__file__), - 'pkgs', - 'viewdecoratorapp', - 'views') - self.config.registry.settings['mako.directories'] = tmpldir def test_first(self): - # we use mako here instead of chameleon because it works on Jython - self._configure_mako() res = self.testapp.get('/first', status=200) self.assertTrue(b'OK' in res.body) def test_second(self): - # we use mako here instead of chameleon because it works on Jython - self._configure_mako() res = self.testapp.get('/second', status=200) self.assertTrue(b'OK2' in res.body) diff --git a/pyramid/tests/test_mako_templating.py b/pyramid/tests/test_mako_templating.py index 50ef360d9..75faa771d 100644 --- a/pyramid/tests/test_mako_templating.py +++ b/pyramid/tests/test_mako_templating.py @@ -22,7 +22,20 @@ class Base(object): def tearDown(self): self.config.end() -class Test_renderer_factory(Base, unittest.TestCase): +def maybe_unittest(): + # The latest release of MarkupSafe (0.17) which is used by Mako is + # incompatible with Python 3.2, so we skip these tests if we cannot + # import a Mako module which ends up importing MarkupSafe. Note that + # this version of MarkupSafe *is* compatible with Python 2.6, 2.7, and 3.3, + # so these tests should not be skipped on those platforms. + try: + import mako.lookup + except (ImportError, SyntaxError, AttributeError): + return object + else: + return unittest.TestCase + +class Test_renderer_factory(Base, maybe_unittest()): def _callFUT(self, info): from pyramid.mako_templating import renderer_factory return renderer_factory(info) @@ -298,7 +311,7 @@ class Test_renderer_factory(Base, unittest.TestCase): self.assertEqual(result.path, 'hello .world.mako') self.assertEqual(result.defname, 'comp') -class MakoRendererFactoryHelperTests(Base, unittest.TestCase): +class MakoRendererFactoryHelperTests(Base, maybe_unittest()): def _getTargetClass(self): from pyramid.mako_templating import MakoRendererFactoryHelper return MakoRendererFactoryHelper @@ -345,7 +358,7 @@ class MakoRendererFactoryHelperTests(Base, unittest.TestCase): self.assertEqual(renderer.path, 'helloworld.mak') self.assertEqual(renderer.lookup, lookup) -class MakoLookupTemplateRendererTests(Base, unittest.TestCase): +class MakoLookupTemplateRendererTests(Base, maybe_unittest()): def _getTargetClass(self): from pyramid.mako_templating import MakoLookupTemplateRenderer return MakoLookupTemplateRenderer @@ -426,7 +439,7 @@ class MakoLookupTemplateRendererTests(Base, unittest.TestCase): self.assertTrue(isinstance(result, text_type)) self.assertEqual(result, text_('result')) -class TestIntegration(unittest.TestCase): +class TestIntegration(maybe_unittest()): def setUp(self): import pyramid.mako_templating self.config = testing.setUp() @@ -501,7 +514,7 @@ class TestIntegration(unittest.TestCase): {'name':'<b>fred</b>'}).replace('\r','') self.assertEqual(result, text_('Hello, <b>fred</b>!\n')) -class TestPkgResourceTemplateLookup(unittest.TestCase): +class TestPkgResourceTemplateLookup(maybe_unittest()): def _makeOne(self, **kw): from pyramid.mako_templating import PkgResourceTemplateLookup return PkgResourceTemplateLookup(**kw) |
