[Checkins] SVN: zope.authentication/trunk/src/zope/authentication/ Break inappropriate testing dependency.

Tres Seaver cvs-admin at zope.org
Fri Jun 29 16:34:19 UTC 2012


Log message for revision 127197:
  Break inappropriate testing dependency.
  
  zope.component.nextutility no longer exists on the z.c trunk.

Changed:
  U   zope.authentication/trunk/src/zope/authentication/principal.py
  A   zope.authentication/trunk/src/zope/authentication/tests/utils.py

-=-
Modified: zope.authentication/trunk/src/zope/authentication/principal.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/principal.py	2012-06-29 16:27:13 UTC (rev 127196)
+++ zope.authentication/trunk/src/zope/authentication/principal.py	2012-06-29 16:34:16 UTC (rev 127197)
@@ -130,7 +130,7 @@
         ...         return ('4', 4),
         >>> dummy3 = DummyUtility3()
 
-        >>> from zope.component.nexttesting import testingNextUtility
+        >>> from zope.authentication.tests.utils import testingNextUtility
         >>> testingNextUtility(dummy1, dummy2, IAuthentication)
         >>> testingNextUtility(dummy2, dummy3, IAuthentication)
 

Added: zope.authentication/trunk/src/zope/authentication/tests/utils.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/tests/utils.py	                        (rev 0)
+++ zope.authentication/trunk/src/zope/authentication/tests/utils.py	2012-06-29 16:34:16 UTC (rev 127197)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+#
+#   Forked from zope.component.nextutility in 3.10.x.
+#
+from zope.interface import implementer
+from zope.component.interfaces import IComponentLookup
+from zope.component.interfaces import IComponents
+
+ at implementer(IComponents)
+class SiteManagerStub(object):
+
+    __bases__ = ()
+
+    def __init__(self):
+        self._utils = {}
+
+    def setNext(self, next):
+        self.__bases__ = (next, )
+
+    def provideUtility(self, iface, util, name=''):
+        self._utils[(iface, name)] = util
+
+    def queryUtility(self, iface, name='', default=None):
+        return self._utils.get((iface, name), default)
+
+def testingNextUtility(utility, nextutility, interface, name='',
+                       sitemanager=None, nextsitemanager=None):
+    if sitemanager is None:
+        sitemanager = SiteManagerStub()
+    if nextsitemanager is None:
+        nextsitemanager = SiteManagerStub()
+    sitemanager.setNext(nextsitemanager)
+
+    sitemanager.provideUtility(interface, utility, name)
+    utility.__conform__ = (
+        lambda iface:
+        iface.isOrExtends(IComponentLookup) and sitemanager or None
+        )
+    nextsitemanager.provideUtility(interface, nextutility, name)
+    nextutility.__conform__ = (
+        lambda iface:
+        iface.isOrExtends(IComponentLookup) and nextsitemanager or None
+        )



More information about the checkins mailing list