[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Fixed functional test failures when running test suite twice.

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Apr 11 09:29:33 EDT 2005


Log message for revision 29943:
  Fixed functional test failures when running test suite twice.
  

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/component.py
  U   Zope3/trunk/src/zope/app/apidoc/presentation.py
  U   Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/component.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/component.py	2005-04-11 13:26:38 UTC (rev 29942)
+++ Zope3/trunk/src/zope/app/apidoc/component.py	2005-04-11 13:29:33 UTC (rev 29943)
@@ -41,6 +41,9 @@
         # Only get adapters
         if not isinstance(reg, (AdapterRegistration, SubscriptionRegistration)):
             continue
+        # Ignore adapters that have no required interfaces
+        if len(reg.required) == 0:
+            continue
         # Ignore views
         if not withViews and reg.required[-1] and \
                reg.required[-1].isOrExtends(IRequest):
@@ -58,6 +61,9 @@
         # Only get adapters
         if not isinstance(reg, (AdapterRegistration, SubscriptionRegistration)):
             continue
+        # Ignore adapters that have no required interfaces
+        if len(reg.required) == 0:
+            continue
         # Ignore views
         if not withViews and reg.required[-1] and \
                reg.required[-1].isOrExtends(IRequest):

Modified: Zope3/trunk/src/zope/app/apidoc/presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/presentation.py	2005-04-11 13:26:38 UTC (rev 29942)
+++ Zope3/trunk/src/zope/app/apidoc/presentation.py	2005-04-11 13:29:33 UTC (rev 29943)
@@ -96,6 +96,7 @@
     gsm = zapi.getGlobalSiteManager()
     for reg in gsm.registrations():
         if (isinstance(reg, AdapterRegistration) and
+            len(reg.required) > 0 and
             reg.required[-1] is not None and
             reg.required[-1].isOrExtends(type)):
 

Modified: Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-04-11 13:26:38 UTC (rev 29942)
+++ Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-04-11 13:29:33 UTC (rev 29943)
@@ -22,6 +22,7 @@
 from zope.app.publisher.browser.resource import Resource
 from zope.app.traversing.api import traverse
 from zope.security.checker import defineChecker, NamesChecker, NoProxy
+from zope.security.checker import _checkers
 from zope.app.container.contained import Contained
 from zope.app.zptpage.zptpage import ZPTPage
 
@@ -124,7 +125,9 @@
 
     def test_resources(self):
         ztapi.browserResource('quux', Resource)
-        defineChecker(Resource, NamesChecker(['__call__']))
+        # Only register the checker once, so that multiple test runs pass.
+        if Resource not in _checkers:
+            defineChecker(Resource, NamesChecker(['__call__']))
         self.addPage('/foo/bar/pt',
                      u'<span tal:replace="context/++resource++quux" />')
         self.verify('/foo/bar/pt', 'http://localhost/@@/quux\n')



More information about the Zope3-Checkins mailing list