summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-04-13 13:47:25 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-04-13 13:47:25 -0400
commitc2373cede978a62eb3c142c5ca4bb1a02a32b3ad (patch)
tree0afaff669595264b10c2b4646d7be4b8d2359763
parentc314ecf67074218cae1ae0c8591a711f37758c72 (diff)
downloadmako-c2373cede978a62eb3c142c5ca4bb1a02a32b3ad.tar.gz
- add py.test settings
- fix this update_wrapper thing so tests are reported nicely
-rw-r--r--mako/util.py13
-rw-r--r--setup.cfg5
-rw-r--r--test/__init__.py6
3 files changed, 12 insertions, 12 deletions
diff --git a/mako/util.py b/mako/util.py
index 0108109..48e3a23 100644
--- a/mako/util.py
+++ b/mako/util.py
@@ -11,15 +11,10 @@ import os
from mako import compat
import operator
-def function_named(fn, name):
- """Return a function with a given __name__.
-
- Will assign to __name__ and return the original function if possible on
- the Python implementation, otherwise a new function will be constructed.
-
- """
- fn.__name__ = name
- return fn
+def update_wrapper(decorated, fn):
+ decorated.__wrapped__ = fn
+ decorated.__name__ = fn.__name__
+ return decorated
class PluginLoader(object):
diff --git a/setup.cfg b/setup.cfg
index c933a4d..6a03440 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,6 +5,11 @@ tag_build = dev
[wheel]
universal = 1
+[pytest]
+addopts= --tb native -v -r fxX
+python_files=test/*test_*.py
+
+
[upload]
sign = 1
identity = C4DAFEE1
diff --git a/test/__init__.py b/test/__init__.py
index f114f64..64dde8e 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -2,7 +2,7 @@ from mako.template import Template
import unittest
import os
from mako.compat import py3k, py26, py25
-from mako.util import function_named
+from mako.util import update_wrapper
import re
from mako.cache import CacheImpl, register_plugin
from nose import SkipTest
@@ -93,7 +93,7 @@ def skip_if(predicate, reason=None):
raise SkipTest(msg)
else:
return fn(*args, **kw)
- return function_named(maybe, fn_name)
+ return update_wrapper(maybe, fn)
return decorate
def requires_python_3(fn):
@@ -124,7 +124,7 @@ def requires_no_pygments_exceptions(fn):
return fn(*arg, **kw)
finally:
exceptions._install_highlighting()
- return function_named(go, fn.__name__)
+ return update_wrapper(go, fn)
class PlainCacheImpl(CacheImpl):
"""Simple memory cache impl so that tests which