[Zope-Checkins] SVN: Zope/trunk/src/ Avoid some more dependencies on Products.Five from outside of it
Hanno Schlichting
hannosch at hannosch.eu
Tue Mar 30 18:12:41 EDT 2010
Log message for revision 110342:
Avoid some more dependencies on Products.Five from outside of it
Changed:
U Zope/trunk/src/OFS/tests/testObjectManager.py
U Zope/trunk/src/OFS/tests/test_registerclass.py
U Zope/trunk/src/OFS/tests/test_registerpackage.py
A Zope/trunk/src/Testing/ZopeTestCase/directives.zcml
U Zope/trunk/src/Testing/ZopeTestCase/testPlaceless.py
-=-
Modified: Zope/trunk/src/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/tests/testObjectManager.py 2010-03-30 21:56:09 UTC (rev 110341)
+++ Zope/trunk/src/OFS/tests/testObjectManager.py 2010-03-30 22:12:41 UTC (rev 110342)
@@ -14,7 +14,6 @@
from OFS.metaconfigure import setDeprecatedManageAddDelete
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
-import Products.Five
from Zope2.App import zcml
from zExceptions import BadRequest
@@ -73,7 +72,8 @@
def setUp(self):
super(ObjectManagerTests, self).setUp()
self.saved_cfg_debug_mode = getConfiguration().debug_mode
- zcml.load_config('meta.zcml', Products.Five)
+ import Zope2.App
+ zcml.load_config('meta.zcml', Zope2.App)
import OFS
zcml.load_config('configure.zcml', OFS)
setDeprecatedManageAddDelete(ItemForDeletion)
Modified: Zope/trunk/src/OFS/tests/test_registerclass.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_registerclass.py 2010-03-30 21:56:09 UTC (rev 110341)
+++ Zope/trunk/src/OFS/tests/test_registerclass.py 2010-03-30 22:12:41 UTC (rev 110342)
@@ -23,7 +23,7 @@
>>> from zope.component.testing import setUp, tearDown
>>> setUp()
>>> import Products
- >>> import Products.Five
+ >>> import Zope2.App
>>> from Zope2.App import zcml
>>> from Products.Five.tests.testing.simplecontent import SimpleContent
>>> from Products.Five.tests.testing.simplecontent import ISimpleContent
@@ -46,7 +46,7 @@
... global="false"
... />
... </configure>'''
- >>> zcml.load_config('meta.zcml', Products.Five)
+ >>> zcml.load_config('meta.zcml', Zope2.App)
>>> zcml.load_string(configure_zcml)
Make sure that the class attributes are set correctly::
Modified: Zope/trunk/src/OFS/tests/test_registerpackage.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_registerpackage.py 2010-03-30 21:56:09 UTC (rev 110341)
+++ Zope/trunk/src/OFS/tests/test_registerpackage.py 2010-03-30 22:12:41 UTC (rev 110342)
@@ -29,9 +29,9 @@
>>> from zope.component.testing import setUp, tearDown
>>> setUp()
>>> import Products
- >>> import Products.Five
+ >>> import Zope2.App
>>> from Zope2.App import zcml
- >>> zcml.load_config('meta.zcml', Products.Five)
+ >>> zcml.load_config('meta.zcml', Zope2.App)
Make sure a python package with a valid initialize gets its
initialize function called::
Added: Zope/trunk/src/Testing/ZopeTestCase/directives.zcml
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/directives.zcml (rev 0)
+++ Zope/trunk/src/Testing/ZopeTestCase/directives.zcml 2010-03-30 22:12:41 UTC (rev 110342)
@@ -0,0 +1,10 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five">
+
+ <adapter
+ for=".testPlaceless.IAdaptable"
+ provides=".testPlaceless.IAdapted"
+ factory=".testPlaceless.Adapter"
+ />
+
+</configure>
Property changes on: Zope/trunk/src/Testing/ZopeTestCase/directives.zcml
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: Zope/trunk/src/Testing/ZopeTestCase/testPlaceless.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/testPlaceless.py 2010-03-30 21:56:09 UTC (rev 110341)
+++ Zope/trunk/src/Testing/ZopeTestCase/testPlaceless.py 2010-03-30 22:12:41 UTC (rev 110342)
@@ -15,24 +15,57 @@
$Id$
"""
+from zope.component import adapts
+from zope.interface import implements, Interface
+
from Testing import ZopeTestCase
from Testing.ZopeTestCase.placeless import setUp, tearDown
from Testing.ZopeTestCase.placeless import zcml
from Testing.ZopeTestCase.placeless import temporaryPlacelessSetUp
-import Products.Five.tests
-from Products.Five.tests.adapters import IAdapted
-from Products.Five.tests.adapters import Adaptable
-
def setupZCML():
import AccessControl
- zcml.load_config('meta.zcml', Products.Five)
+ import Zope2.App
+ zcml.load_config('meta.zcml', Zope2.App)
zcml.load_config('permissions.zcml', AccessControl)
- zcml.load_config('directives.zcml', Products.Five.tests)
+ zcml.load_config('directives.zcml', ZopeTestCase)
+class IAdaptable(Interface):
+ """This is a Zope interface.
+ """
+ def method():
+ """This method will be adapted
+ """
+
+class IAdapted(Interface):
+ """The interface we adapt to.
+ """
+
+ def adaptedMethod():
+ """A method to adapt.
+ """
+
+class Adaptable:
+ implements(IAdaptable)
+
+ def method(self):
+ return "The method"
+
+
+class Adapter:
+ implements(IAdapted)
+ adapts(IAdaptable)
+
+ def __init__(self, context):
+ self.context = context
+
+ def adaptedMethod(self):
+ return "Adapted: %s" % self.context.method()
+
+
class TestPlacelessSetUp(ZopeTestCase.ZopeTestCase):
'''Tests ZopeTestCase with placeless setup'''
More information about the Zope-Checkins
mailing list