Hi Alexander, (cc py-dev), if you want to revive this, then please also the test - and it's better to copy the old revision (svn cp can do that, i think) then to re-add it and loose all history.
I am not sure, i am in favour of re-adding this, though. do you actually use it? holger ----- Forwarded message from [EMAIL PROTECTED] ----- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Fri, 20 Apr 2007 00:39:27 +0200 (CEST) Subject: [py-svn] r42188 - py/trunk/py/test X-Spambayes-Classification: ham; 0.00 Author: xoraxax Date: Fri Apr 20 00:39:27 2007 New Revision: 42188 Added: py/trunk/py/test/compat.py Log: Revive test/compat.py again, seems to work fine for me. Can be used by patching sys.modules["unittest"] in the conftest.py file. Added: py/trunk/py/test/compat.py ============================================================================== --- (empty file) +++ py/trunk/py/test/compat.py Fri Apr 20 00:39:27 2007 @@ -0,0 +1,59 @@ +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'] _______________________________________________ py-svn mailing list [EMAIL PROTECTED] http://codespeak.net/mailman/listinfo/py-svn ----- End forwarded message ----- -- merlinux GmbH Steinbergstr. 42 31139 Hildesheim http://merlinux.de tel +49 5121 20800 75 (fax 77) _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev