[Checkins] SVN: zope.lifecycleevent/trunk/ Refactor tests to loose zope.annotation and zope.dublincore as dependencies.

Hanno Schlichting hannosch at hannosch.eu
Tue Dec 29 15:08:53 EST 2009


Log message for revision 107299:
  Refactor tests to loose zope.annotation and zope.dublincore as dependencies.
  

Changed:
  U   zope.lifecycleevent/trunk/CHANGES.txt
  U   zope.lifecycleevent/trunk/setup.py
  U   zope.lifecycleevent/trunk/src/zope/lifecycleevent/README.txt
  U   zope.lifecycleevent/trunk/src/zope/lifecycleevent/__init__.py
  U   zope.lifecycleevent/trunk/src/zope/lifecycleevent/tests.py

-=-
Modified: zope.lifecycleevent/trunk/CHANGES.txt
===================================================================
--- zope.lifecycleevent/trunk/CHANGES.txt	2009-12-29 19:46:09 UTC (rev 107298)
+++ zope.lifecycleevent/trunk/CHANGES.txt	2009-12-29 20:08:53 UTC (rev 107299)
@@ -2,10 +2,10 @@
 CHANGES
 =======
 
-3.5.3 (unreleased)
+3.6.0 (unreleased)
 ------------------
 
-- ...
+- Refactor tests to loose zope.annotation and zope.dublincore as dependencies.
 
 3.5.2 (2009-05-17)
 ------------------

Modified: zope.lifecycleevent/trunk/setup.py
===================================================================
--- zope.lifecycleevent/trunk/setup.py	2009-12-29 19:46:09 UTC (rev 107298)
+++ zope.lifecycleevent/trunk/setup.py	2009-12-29 20:08:53 UTC (rev 107299)
@@ -28,7 +28,7 @@
 
 setup(
     name='zope.lifecycleevent',
-    version='3.5.3dev',
+    version='3.6.0dev',
     url='http://pypi.python.org/pypi/zope.lifecycleevent',
     author='Zope Corporation and Contributors',
     author_email='zope-dev at zope.org',
@@ -57,9 +57,7 @@
                       'zope.component',
                       'zope.event'],
     extras_require=dict(
-        test = ['zope.annotation',
-                'zope.dublincore',
-                'zope.container',]
+        test = ['zope.container',]
         ),
     zip_safe=False,
     )

Modified: zope.lifecycleevent/trunk/src/zope/lifecycleevent/README.txt
===================================================================
--- zope.lifecycleevent/trunk/src/zope/lifecycleevent/README.txt	2009-12-29 19:46:09 UTC (rev 107298)
+++ zope.lifecycleevent/trunk/src/zope/lifecycleevent/README.txt	2009-12-29 20:08:53 UTC (rev 107299)
@@ -2,7 +2,7 @@
 Life-cycle events
 =================
 
-In Zope 3, events are used by components to inform each other about
+In Zope, events are used by components to inform each other about
 relevant new objects and object modifications.
 
 To keep all subscribers up to date it is indispensable that the life
@@ -19,14 +19,11 @@
     
     >>> obj.modified = True
     >>> notify(ObjectModifiedEvent(obj))
-    
-Zope 3's Dublin Core Metadata for instance, rely on the bare
-ObjectCreatedEvent and ObjectModifiedEvent to record creation and
-modification times. Other event consumers like catalogs and caches may
-need more information to update themselves in an efficient manner. The
-necessary information can be provided as optional modification
-descriptions of the ObjectModifiedEvent.
 
+Some event consumers like catalogs and caches may need more information to
+update themselves in an efficient manner. The necessary information can be
+provided as optional modification descriptions of the ObjectModifiedEvent.
+
 Some examples:
 
     >>> from zope.interface import Interface, Attribute, implements
@@ -41,31 +38,7 @@
     >>> file = File()
     >>> file.data = "123"
     >>> notify(ObjectModifiedEvent(obj, IFile))
-    
-This says that we modified something via IFile.  Note that an interface is an 
-acceptable description. In fact, we might allow pretty much anything as a 
-description and it depends on your needs what kind of descriptions 
-you use.
 
-In the following we use an IAttributes description to describe in more detail
-which parts of an object where modified :
-
-    >>> file.data = "456"
- 
-    >>> from zope.dublincore.interfaces import IZopeDublinCore
-    >>> from zope.interface import directlyProvides
-    >>> from zope.annotation.interfaces import IAttributeAnnotatable
-    >>> directlyProvides(file, IAttributeAnnotatable) 
-    
-    >>> IZopeDublinCore(file).title = u"New title"
-    >>> IZopeDublinCore(file).title = u"New description"
-
-    >>> from zope.lifecycleevent import Attributes
-    >>> event = ObjectModifiedEvent(
-    ...     obj,
-    ...     Attributes(IFile, 'data'),
-    ...     Attributes(IZopeDublinCore, 'title', 'description'),
-    ...     )
-    >>> notify(event)
-
-This says we modified the file data and the DC title and description.
+This says that we modified something via IFile. Note that an interface is an
+acceptable description. In fact, we might allow pretty much anything as a
+description and it depends on your needs what kind of descriptions you use.

Modified: zope.lifecycleevent/trunk/src/zope/lifecycleevent/__init__.py
===================================================================
--- zope.lifecycleevent/trunk/src/zope/lifecycleevent/__init__.py	2009-12-29 19:46:09 UTC (rev 107298)
+++ zope.lifecycleevent/trunk/src/zope/lifecycleevent/__init__.py	2009-12-29 20:08:53 UTC (rev 107299)
@@ -41,13 +41,12 @@
     """
     Describes modified attributes of an interface.
 
-        >>> from zope.dublincore.interfaces import IZopeDublinCore
-        >>> desc = Attributes(IZopeDublinCore, "title", "description")
-        >>> desc.interface == IZopeDublinCore
+        >>> from zope.lifecycleevent.interfaces import IObjectMovedEvent
+        >>> desc = Attributes(IObjectMovedEvent, "newName", "newParent")
+        >>> desc.interface == IObjectMovedEvent
         True
-        >>> 'title' in desc.attributes
+        >>> 'newName' in desc.attributes
         True
-
     """
 
     implements(IAttributes)

Modified: zope.lifecycleevent/trunk/src/zope/lifecycleevent/tests.py
===================================================================
--- zope.lifecycleevent/trunk/src/zope/lifecycleevent/tests.py	2009-12-29 19:46:09 UTC (rev 107298)
+++ zope.lifecycleevent/trunk/src/zope/lifecycleevent/tests.py	2009-12-29 20:08:53 UTC (rev 107299)
@@ -153,21 +153,13 @@
 class Context:
     pass
 
-def setUpDoctest(test):
-    from zope.annotation.attribute import AttributeAnnotations
-    from zope.dublincore.interfaces import IWriteZopeDublinCore
-    from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
-    zope.component.provideAdapter(AttributeAnnotations)
-    zope.component.provideAdapter(ZDCAnnotatableAdapter,
-                                  provides=IWriteZopeDublinCore)
-
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(TestObjectModifiedEvent),
         unittest.makeSuite(TestObjectMovedEvent),
         unittest.makeSuite(TestObjectAddedEvent),
         unittest.makeSuite(TestObjectRemovedEvent),
-        doctest.DocFileSuite('README.txt', setUp=setUpDoctest,
+        doctest.DocFileSuite('README.txt',
                              tearDown=zope.component.testing.tearDown),
         ))
 



More information about the checkins mailing list