[Zope-Checkins] SVN: Zope/branches/2.12/src/OFS/tests/testSimpleItem.py Fix tests broken by string-exception-geddon in 2.12.

Tres Seaver tseaver at palladion.com
Mon Jan 11 17:23:11 EST 2010


Log message for revision 108038:
  Fix tests broken by string-exception-geddon in 2.12.

Changed:
  U   Zope/branches/2.12/src/OFS/tests/testSimpleItem.py

-=-
Modified: Zope/branches/2.12/src/OFS/tests/testSimpleItem.py
===================================================================
--- Zope/branches/2.12/src/OFS/tests/testSimpleItem.py	2010-01-11 22:05:09 UTC (rev 108037)
+++ Zope/branches/2.12/src/OFS/tests/testSimpleItem.py	2010-01-11 22:23:10 UTC (rev 108038)
@@ -23,6 +23,9 @@
         verifyClass(IManageable, self._getTargetClass())
 
     def test_raise_StandardErrorMessage_str_errorValue(self):
+        class REQUEST(object):
+            class RESPONSE(object):
+                handle_errors = True
         item = self._makeOne()
         def _raise_during_standard_error_message(*args, **kw):
             raise ZeroDivisionError('testing')
@@ -31,17 +34,20 @@
             item.raise_standardErrorMessage(
                             error_type=OverflowError,
                             error_value='simple',
-                            REQUEST={'dummy': ''},
+                            REQUEST=REQUEST(),
                             )
         except:
             import sys
-            self.assertEqual(sys.exc_info()[0], 'OverflowError')
+            self.assertEqual(sys.exc_info()[0], OverflowError)
             value = sys.exc_info()[1]
-            self.failUnless(value.startswith("'simple'"))
-            self.failUnless('full details: testing' in value)
+            self.failUnless(value.message.startswith("'simple'"))
+            self.failUnless('full details: testing' in value.message)
 
     def test_raise_StandardErrorMessage_TaintedString_errorValue(self):
         from ZPublisher.TaintedString import TaintedString
+        class REQUEST(object):
+            class RESPONSE(object):
+                handle_errors = True
         item = self._makeOne()
         def _raise_during_standard_error_message(*args, **kw):
             raise ZeroDivisionError('testing')
@@ -50,13 +56,13 @@
             item.raise_standardErrorMessage(
                             error_type=OverflowError,
                             error_value=TaintedString('<simple>'),
-                            REQUEST={'dummy': ''},
+                            REQUEST=REQUEST(),
                             )
         except:
             import sys
-            self.assertEqual(sys.exc_info()[0], 'OverflowError')
+            self.assertEqual(sys.exc_info()[0], OverflowError)
             value = sys.exc_info()[1]
-            self.failIf('<' in value)
+            self.failIf('<' in value.message)
 
 
 class TestItem_w__name__(unittest.TestCase):



More information about the Zope-Checkins mailing list