[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/ Move event testing setup to zope.component.testing.

Philipp von Weitershausen philikon at philikon.de
Fri Apr 7 08:43:48 EDT 2006


Log message for revision 66641:
  Move event testing setup to zope.component.testing.
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/event/tests/__init__.py
  D   Zope3/branches/jim-adapter/src/zope/app/event/tests/placelesssetup.py
  U   Zope3/branches/jim-adapter/src/zope/app/testing/placelesssetup.py
  U   Zope3/branches/jim-adapter/src/zope/component/testing.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/event/tests/__init__.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/event/tests/__init__.py	2006-04-07 12:41:43 UTC (rev 66640)
+++ Zope3/branches/jim-adapter/src/zope/app/event/tests/__init__.py	2006-04-07 12:43:47 UTC (rev 66641)
@@ -1,2 +1,8 @@
-#
 # This file is necessary to make this directory a package.
+
+import zope.deferredimport
+zope.deferredimport.deprecated(
+    "Its contents has moved into zope.component.testing.  This reference "
+    "will be gone in Zope 3.5",
+    placelesssetup = 'zope.component.testing',
+    )

Deleted: Zope3/branches/jim-adapter/src/zope/app/event/tests/placelesssetup.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/event/tests/placelesssetup.py	2006-04-07 12:41:43 UTC (rev 66640)
+++ Zope3/branches/jim-adapter/src/zope/app/event/tests/placelesssetup.py	2006-04-07 12:43:47 UTC (rev 66641)
@@ -1,45 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002 Zope Corporation 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.
-#
-##############################################################################
-"""Unit test logic for setting up and tearing down basic infrastructure
-
-$Id$
-"""
-import zope.component
-from zope.component.event import objectEventNotify
-
-events = []
-
-def getEvents(event_type=None, filter=None):
-    r = []
-    for event in events:
-        if event_type is not None and not event_type.providedBy(event):
-            continue
-        if filter is not None and not filter(event):
-            continue
-        r.append(event)
-
-    return r
-
-def clearEvents():
-    del events[:]
-
-class PlacelessSetup(object):
-
-    def setUp(self):
-        zope.component.provideHandler(events.append, (None,))
-        zope.component.provideHandler(objectEventNotify)
-        clearEvents()
-
-import zope.testing.cleanup
-zope.testing.cleanup.addCleanUp(clearEvents)

Modified: Zope3/branches/jim-adapter/src/zope/app/testing/placelesssetup.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/testing/placelesssetup.py	2006-04-07 12:41:43 UTC (rev 66640)
+++ Zope3/branches/jim-adapter/src/zope/app/testing/placelesssetup.py	2006-04-07 12:43:47 UTC (rev 66641)
@@ -21,8 +21,6 @@
 from zope.traversing.browser.absoluteurl import AbsoluteURL
 
 from zope.app.testing import ztapi
-from zope.app.event.tests.placelesssetup \
-    import PlacelessSetup as EventPlacelessSetup
 from zope.app.i18n.tests.placelesssetup \
     import PlacelessSetup as I18nPlacelessSetup
 from zope.app.container.tests.placelesssetup \
@@ -32,16 +30,13 @@
 from zope.app.security._protections import protect
 
 class PlacelessSetup(CAPlacelessSetup,
-                     EventPlacelessSetup,
                      I18nPlacelessSetup,
                      ContainerPlacelessSetup,
-                     AuthenticationPlacelessSetup
-                     ):
+                     AuthenticationPlacelessSetup):
 
     def setUp(self, doctesttest=None):
         CAPlacelessSetup.setUp(self)
         ContainerPlacelessSetup.setUp(self)
-        EventPlacelessSetup.setUp(self)
         I18nPlacelessSetup.setUp(self)
         AuthenticationPlacelessSetup.setUp(self)
         # Register app-specific security declarations

Modified: Zope3/branches/jim-adapter/src/zope/component/testing.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/component/testing.py	2006-04-07 12:41:43 UTC (rev 66640)
+++ Zope3/branches/jim-adapter/src/zope/component/testing.py	2006-04-07 12:43:47 UTC (rev 66641)
@@ -15,20 +15,35 @@
 
 $Id$
 """
+import zope.component
+from zope.component.event import objectEventNotify
 from zope.testing import cleanup
 
-# A mix-in class inheriting from CleanUp that also connects the CA services
+events = []
+def getEvents(event_type=None, filter=None):
+    r = []
+    for event in events:
+        if event_type is not None and not event_type.providedBy(event):
+            continue
+        if filter is not None and not filter(event):
+            continue
+        r.append(event)
+
+    return r
+
+def clearEvents():
+    del events[:]
+cleanup.addCleanUp(clearEvents)
+
 class PlacelessSetup(cleanup.CleanUp):
 
     def setUp(self):
         super(PlacelessSetup, self).setUp()
+        zope.component.provideHandler(events.append, (None,))
+        zope.component.provideHandler(objectEventNotify)
 
-    def tearDown(self):
-        super(PlacelessSetup, self).tearDown()
-
-
 def setUp(test=None):
-    cleanup.setUp()
+    PlacelessSetup().setUp()
 
 def tearDown(test=None):
-    cleanup.tearDown()
+    PlacelessSetup().tearDown()



More information about the Zope3-Checkins mailing list