Commit b96b2151 authored by Hanno Schlichting's avatar Hanno Schlichting

Avoid some more dependencies on Products.Five from outside of it

parent e33526ea
......@@ -14,7 +14,6 @@ from logging import getLogger
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 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
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)
......
......@@ -23,7 +23,7 @@ def test_registerClass():
>>> 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 @@ def test_registerClass():
... 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::
......
......@@ -29,9 +29,9 @@ def test_registerPackage():
>>> 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::
......
<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>
......@@ -15,22 +15,55 @@
$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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment