diff options
Diffstat (limited to 'test/__init__.py')
-rw-r--r-- | test/__init__.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/__init__.py b/test/__init__.py index ded1a5d..c983c5d 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,6 +1,7 @@ from mako.template import Template -import unittest, os -from mako.util import py3k, py26, py25 +import unittest +import os +from mako.compat import py3k, py26, py25 from mako.util import function_named import re from mako.cache import CacheImpl, register_plugin @@ -64,7 +65,7 @@ def assert_raises(except_cls, callable_, *args, **kw): try: callable_(*args, **kw) success = False - except except_cls, e: + except except_cls as e: success = True # assert outside the block so it works for AssertionError too ! @@ -74,9 +75,9 @@ def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: callable_(*args, **kwargs) assert False, "Callable did not raise an exception" - except except_cls, e: + except except_cls as e: assert re.search(msg, str(e)), "%r !~ %s" % (msg, e) - print str(e) + print(str(e)) def skip_if(predicate, reason=None): """Skip a test if predicate is true.""" |