From 4fbfa8109926400c86e09415fd9736400e67dfc7 Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Wed, 18 Jan 2012 19:45:27 +0100 Subject: [PATCH] Test the 'division by zero' message in a smarter way so it adapts itself to the python version --- wsme/tests/protocol.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wsme/tests/protocol.py b/wsme/tests/protocol.py index 077241d..c516ea2 100644 --- a/wsme/tests/protocol.py +++ b/wsme/tests/protocol.py @@ -17,6 +17,11 @@ warnings.filterwarnings('ignore', module='webob.dec') binarysample = r'\x00\xff\x43' +try: + 1 / 0 +except ZeroDivisionError, e: + zerodivisionerrormsg = str(e) + class CallException(RuntimeError): def __init__(self, faultcode, faultstring, debuginfo): @@ -312,7 +317,7 @@ class ProtocolTestCase(unittest.TestCase): except CallException, e: print e assert e.faultcode == 'Server' - assert e.faultstring == u'integer division or modulo by zero' + assert e.faultstring == zerodivisionerrormsg assert e.debuginfo is not None def test_serverside_error_nodebug(self): @@ -324,7 +329,7 @@ class ProtocolTestCase(unittest.TestCase): except CallException, e: print e assert e.faultcode == 'Server' - assert e.faultstring == u'integer division or modulo by zero' + assert e.faultstring == zerodivisionerrormsg assert e.debuginfo is None def test_touch(self):