changeset 4033:404220520c63

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Aug 2008 18:03:16 +0200
parents 070d03f8fd7b (current diff) 8a1c8fb7c689 (diff)
children 8ced48dc0a3d
files MoinMoin/_tests/compat.py
diffstat 2 files changed, 1 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/compat.py	Sun Aug 24 18:02:28 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-""" UnitTest compatiblity code, from the py lib. MIT licensed originally, copyright Holger Krekel. """
-
-import py
-from py.__.test.outcome import Failed, Passed
-
-
-class TestCaseUnit(py.test.collect.Function):
-    """ compatibility Unit executor for TestCase methods
-        honouring setUp and tearDown semantics.
-    """
-    def execute(self, session):
-        boundmethod = self.obj
-        instance = boundmethod.im_self
-        instance.setUp()
-        try:
-            boundmethod()
-        finally:
-            instance.tearDown()
-        return Passed()
-
-class TestCase(object):
-    """compatibility class of unittest's TestCase. """
-    Function = TestCaseUnit
-
-    def setUp(self):
-        pass
-
-    def tearDown(self):
-        pass
-
-    def fail(self, msg=None):
-        """ fail immediate with given message. """
-        raise Failed(msg=msg)
-
-    def assertRaises(self, excclass, func, *args, **kwargs):
-        py.test.raises(excclass, func, *args, **kwargs)
-    failUnlessRaises = assertRaises
-
-    # dynamically construct (redundant) methods
-    aliasmap = [
-        ('x',   'not x', 'assert_, failUnless'),
-        ('x',   'x',     'failIf'),
-        ('x,y', 'x!=y',  'failUnlessEqual,assertEqual, assertEquals'),
-        ('x,y', 'x==y',  'failIfEqual,assertNotEqual, assertNotEquals'),
-        ]
-    items = []
-    for sig, expr, names in aliasmap:
-        names = map(str.strip, names.split(','))
-        sigsubst = expr.replace('y', '%s').replace('x', '%s')
-        for name in names:
-            items.append("""
-                def %(name)s(self, %(sig)s, msg=""):
-                    __tracebackhide__ = True
-                    if %(expr)s:
-                        raise Failed(msg=msg + (%(sigsubst)r %% (%(sig)s)))
-            """ % locals() )
-
-    source = "".join(items)
-    exec py.code.Source(source).compile()
-
-__all__ = ['TestCase']
--- a/MoinMoin/conftest.py	Sun Aug 24 18:02:28 2008 +0200
+++ b/MoinMoin/conftest.py	Sun Aug 24 18:03:16 2008 +0200
@@ -30,8 +30,7 @@
 sys.path.insert(0, str(moindir))
 
 from MoinMoin.support.python_compatibility import set
-from MoinMoin._tests import maketestwiki, compat, wikiconfig
-sys.modules["unittest"] = compat # evil hack
+from MoinMoin._tests import maketestwiki, wikiconfig
 
 coverage_modules = set()