[Checkins] SVN: zc.relationship/trunk/src/zc/relationship/ Get rid
of unit test deprecations
Gary Poster
gary at zope.com
Thu Apr 27 23:25:46 EDT 2006
Log message for revision 67683:
Get rid of unit test deprecations
Changed:
U zc.relationship/trunk/src/zc/relationship/README.txt
U zc.relationship/trunk/src/zc/relationship/container.txt
U zc.relationship/trunk/src/zc/relationship/tests.py
-=-
Modified: zc.relationship/trunk/src/zc/relationship/README.txt
===================================================================
--- zc.relationship/trunk/src/zc/relationship/README.txt 2006-04-28 03:25:22 UTC (rev 67682)
+++ zc.relationship/trunk/src/zc/relationship/README.txt 2006-04-28 03:25:45 UTC (rev 67683)
@@ -266,20 +266,12 @@
site manager with the desired intid utility, everything should work fine, so
no need to install it as utility. This is just an example.
- >>> from zope.app.component.interfaces import ILocalUtility
>>> from zope import interface
- >>> interface.alsoProvides(ix, ILocalUtility)
>>> sm = app.getSiteManager()
- >>> package = sm['default']
- >>> package['rel_index'] = ix
- >>> import zope.app.utility
- >>> registration = zope.app.utility.UtilityRegistration(
- ... 'rel_index', interfaces.IIndex,
- ... package['rel_index'])
- >>> key = package.registrationManager.addRegistration(registration)
- >>> import zope.app.component.interfaces.registration
- >>> registration.status = (
- ... zope.app.component.interfaces.registration.ActiveStatus)
+ >>> sm['rel_index'] = ix
+ >>> import zope.component.interfaces
+ >>> registry = zope.component.interfaces.IComponentRegistry(sm)
+ >>> registry.registerUtility(ix, interfaces.IIndex)
>>> import transaction
>>> transaction.commit()
Modified: zc.relationship/trunk/src/zc/relationship/container.txt
===================================================================
--- zc.relationship/trunk/src/zc/relationship/container.txt 2006-04-28 03:25:22 UTC (rev 67682)
+++ zc.relationship/trunk/src/zc/relationship/container.txt 2006-04-28 03:25:45 UTC (rev 67683)
@@ -57,25 +57,14 @@
True
The containers can be used as parts of other objects, or as standalone local
-utilities. Here's an example of adding one as a local utilty. Note that
-relationship containers do not implement ILocalUtility by default; this is
-usually done with the "utility" zcml tag or the "implements" zcml tag. We'll
-specify it here by hand.
+utilities. Here's an example of adding one as a local utilty.
- >>> from zope.app.component.interfaces import ILocalUtility
- >>> from zope import interface
- >>> interface.alsoProvides(container, ILocalUtility)
>>> sm = app.getSiteManager()
- >>> package = sm['default']
- >>> package['lineage_relationship'] = container
- >>> import zope.app.utility
- >>> registration = zope.app.utility.UtilityRegistration(
- ... 'lineage', interfaces.IRelationshipContainer,
- ... package['lineage_relationship'])
- >>> key = package.registrationManager.addRegistration(registration)
- >>> import zope.app.component.interfaces.registration
- >>> registration.status = (
- ... zope.app.component.interfaces.registration.ActiveStatus)
+ >>> sm['lineage_relationship'] = container
+ >>> import zope.component.interfaces
+ >>> registry = zope.component.interfaces.IComponentRegistry(sm)
+ >>> registry.registerUtility(
+ ... container, interfaces.IRelationshipContainer, 'lineage')
>>> import transaction
>>> transaction.commit()
Modified: zc.relationship/trunk/src/zc/relationship/tests.py
===================================================================
--- zc.relationship/trunk/src/zc/relationship/tests.py 2006-04-28 03:25:22 UTC (rev 67682)
+++ zc.relationship/trunk/src/zc/relationship/tests.py 2006-04-28 03:25:45 UTC (rev 67683)
@@ -28,17 +28,15 @@
from zope import component, interface
import zope.component.interfaces
-from zope.component.tests import placelesssetup
+import zope.location.interfaces
+from zope.app.testing import placelesssetup
from zope.app.keyreference.persistent import (
KeyReferenceToPersistent, connectionOfPersistent)
from zope.app.folder import rootFolder
-import zope.app.utility
from zope.app.component.site import LocalSiteManager, SiteManagerAdapter
from zope.app.intid import IntIds
from zope.app.intid.interfaces import IIntIds
import zope.app.component.interfaces.registration
-import zope.app.annotation.interfaces
-import zope.app.annotation.attribute
from zc.relationship import intid, keyref, shared
@@ -53,8 +51,8 @@
component.provideAdapter(KeyReferenceToPersistent, adapts=(IPersistent,))
component.provideAdapter(
SiteManagerAdapter,
- adapts=(None,),
- provides=zope.component.interfaces.ISiteManager)
+ (zope.location.interfaces.ILocation,),
+ zope.component.interfaces.IComponentLookup)
component.provideAdapter(
connectionOfPersistent,
adapts=(IPersistent,),
@@ -75,13 +73,9 @@
keyrefSetUp(test)
app = test.globs['app']
sm = app.getSiteManager()
- package = sm['default']
- package['intids'] = IntIds()
- registration = zope.app.utility.UtilityRegistration(
- '', IIntIds, package['intids'])
- key = package.registrationManager.addRegistration(registration)
- registration.status = (
- zope.app.component.interfaces.registration.ActiveStatus)
+ sm['intids'] = IntIds()
+ registry = zope.component.interfaces.IComponentRegistry(sm)
+ registry.registerUtility(sm['intids'], IIntIds)
transaction.commit()
test.globs['Container'] = intid.Container
test.globs['Relationship'] = shared.Relationship
More information about the Checkins
mailing list