[Checkins] SVN: zope.error/trunk/ Use a mock request for testing. Dropped the dependency on zope.publisher

Thomas Lotze tl at gocept.com
Mon Sep 28 02:37:45 EDT 2009


Log message for revision 104581:
  Use a mock request for testing. Dropped the dependency on zope.publisher
  which was really only a testing dependency.
  

Changed:
  U   zope.error/trunk/CHANGES.txt
  U   zope.error/trunk/setup.py
  U   zope.error/trunk/src/zope/error/tests.py

-=-
Modified: zope.error/trunk/CHANGES.txt
===================================================================
--- zope.error/trunk/CHANGES.txt	2009-09-27 20:08:54 UTC (rev 104580)
+++ zope.error/trunk/CHANGES.txt	2009-09-28 06:37:45 UTC (rev 104581)
@@ -20,6 +20,9 @@
 
 - Add dependency on ZODB3 as we use Persistent.
 
+- Use a mock request for testing. Dropped the dependency on zope.publisher
+  which was really only a testing dependency.
+
 3.6.0 (2009-01-31)
 ------------------
 

Modified: zope.error/trunk/setup.py
===================================================================
--- zope.error/trunk/setup.py	2009-09-27 20:08:54 UTC (rev 104580)
+++ zope.error/trunk/setup.py	2009-09-28 06:37:45 UTC (rev 104581)
@@ -58,7 +58,6 @@
                       'zope.container',
                       'zope.exceptions',
                       'zope.interface',
-                      'zope.publisher',
                       'ZODB3', # error.py imports from persistent
                       ],
     include_package_data = True,

Modified: zope.error/trunk/src/zope/error/tests.py
===================================================================
--- zope.error/trunk/src/zope/error/tests.py	2009-09-27 20:08:54 UTC (rev 104580)
+++ zope.error/trunk/src/zope/error/tests.py	2009-09-28 06:37:45 UTC (rev 104581)
@@ -19,11 +19,11 @@
 import unittest
 
 from zope.exceptions.exceptionformatter import format_exception
-from zope.publisher.tests.httprequest import TestRequest
 from zope.testing import cleanup
 
 from zope.error.error import ErrorReportingUtility, getFormattedException
 
+
 class Error(Exception):
 
     def __init__(self, value):
@@ -32,12 +32,27 @@
     def __str__(self):
         return self.value
 
+
 def getAnErrorInfo(value=""):
     try:
         raise Error(value)
     except:
         return sys.exc_info()
 
+
+class TestRequest(object):
+    """Mock request that mimics the zope.publisher request."""
+
+    def __init__(self, environ=None):
+        self._environ = environ or {}
+
+    def setPrincipal(self, principal):
+        self.principal = principal
+
+    def items(self):
+        return []
+
+
 class ErrorReportingUtilityTests(cleanup.CleanUp, unittest.TestCase):
 
     def test_checkForEmptyLog(self):



More information about the checkins mailing list