[Zope3-checkins] CVS: Zope3/src/zope/app/component/tests - service.py:1.1.2.1 test_directives.py:1.1.2.2 test_interfacefield.py:1.1.2.2 test_servicedirective.py:1.1.2.2 test_service.py:NONE
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 17:23:07 -0500
Update of /cvs-repository/Zope3/src/zope/app/component/tests
In directory cvs.zope.org:/tmp/cvs-serv19409/src/zope/app/component/tests
Modified Files:
Tag: NameGeddon-branch
test_directives.py test_interfacefield.py
test_servicedirective.py
Added Files:
Tag: NameGeddon-branch
service.py
Removed Files:
Tag: NameGeddon-branch
test_service.py
Log Message:
changes to get zope.component tests to almost pass
=== Added File Zope3/src/zope/app/component/tests/service.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""
$Id: service.py,v 1.1.2.1 2002/12/23 22:22:36 jim Exp $
"""
__metaclass__ = type # All classes are new style when run with Python 2.2+
from zope.interface import Interface
class IFooService(Interface):
def foo(): pass
def foobar(): pass
class FooService:
__implements__ = IFooService
def foo(self): return "foo here"
def foobar(self): return "foobarred"
def bar(self): return "you shouldn't get this"
fooService = FooService()
class Foo2(FooService): pass
foo2 = Foo2()
=== Zope3/src/zope/app/component/tests/test_directives.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/test_directives.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/test_directives.py Mon Dec 23 17:22:36 2002
@@ -23,15 +23,14 @@
from zope.security.proxy import getTestProxyItems, getObject as proxiedObject
-import Zope.App.ComponentArchitecture
+import zope.app.component
from zope.component.exceptions import ComponentLookupError
-from zope.component \
- import getView, queryView, getResource, queryResource, createObject
+from zope.component import getView, queryView, getResource, queryResource
+from zope.component import createObject
from zope.component import getDefaultViewName
from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.tests.test_views import \
- IV, IC, V1, VZMI, R1, RZMI
+from zope.component.tests.views import IV, IC, V1, VZMI, R1, RZMI
from zope.component.tests.request import Request
@@ -45,7 +44,7 @@
__implements__ = IC
def definePermissions():
- XMLConfig('meta.zcml', Zope.App.ContentDirective)()
+ XMLConfig('meta.zcml', zope.app.contentdirective)()
class Test(PlacelessSetup, unittest.TestCase):
@@ -53,24 +52,23 @@
def setUp(self):
PlacelessSetup.setUp(self)
- XMLConfig('meta.zcml', Zope.App.ComponentArchitecture)()
- XMLConfig('meta.zcml', Zope.App.Security)()
+ XMLConfig('meta.zcml', zope.app.component)()
+ XMLConfig('meta.zcml', zope.app.security)()
def testAdapter(self):
from zope.component import getAdapter, queryAdapter
# Full import is critical!
- from zope.component.tests.test_components \
- import Content, IApp, Comp
+ from zope.component.tests.components import Content, IApp, Comp
self.assertEqual(queryAdapter(Content(), IV, None), None)
xmlconfig(StringIO(template % (
"""
<adapter
- factory="Zope.ComponentArchitecture.tests.TestComponents.Comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
- for="Zope.ComponentArchitecture.tests.TestComponents.IContent"
+ factory="zope.component.tests.components.Comp"
+ provides="zope.component.tests.components.IApp"
+ for="zope.component.tests.components.IContent"
/>
"""
)))
@@ -82,8 +80,7 @@
from zope.component import getAdapter, queryAdapter
# Full import is critical!
- from zope.component.tests.test_components \
- import Content, IApp, Comp
+ from zope.component.tests.components import Content, IApp, Comp
self.testAdapter()
self.assertEqual(getAdapter(Content(), IApp).__class__, Comp)
@@ -93,9 +90,9 @@
xmlconfig(StringIO(template % (
"""
<adapter
- factory="Zope.ComponentArchitecture.tests.TestComponents.Comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
- for="Zope.ComponentArchitecture.tests.TestComponents.IContent"
+ factory="zope.component.tests.components.Comp"
+ provides="zope.component.tests.components.IApp"
+ for="zope.component.tests.components.IContent"
name="test"
/>
"""
@@ -108,17 +105,16 @@
from zope.component import getAdapter, queryAdapter
# Full import is critical!
- from zope.component.tests.test_components \
- import Content, IApp, Comp
+ from zope.component.tests.components import Content, IApp, Comp
self.assertEqual(queryAdapter(Content(), IV, None), None)
xmlconfig(StringIO(template % (
"""
<adapter
- factory="Zope.ComponentArchitecture.tests.TestComponents.Comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
- for="Zope.ComponentArchitecture.tests.TestComponents.IContent"
+ factory="zope.component.tests.components.Comp"
+ provides="zope.component.tests.components.IApp"
+ for="zope.component.tests.components.IContent"
permission="Zope.Public"
/>
"""
@@ -133,9 +129,9 @@
config = StringIO(template % (
"""
<adapter
- factory="Zope.ComponentArchitecture.tests.TestComponents.Comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
- for="Zope.ComponentArchitecture.tests.TestComponents.IContent"
+ factory="zope.component.tests.components.Comp"
+ provides="zope.component.tests.components.IApp"
+ for="zope.component.tests.components.IContent"
permission="UndefinedPermission"
/>
"""
@@ -147,16 +143,15 @@
from zope.component import getUtility, queryUtility
# Full import is critical!
- from zope.component.tests.test_components \
- import IApp, comp
+ from zope.component.tests.components import IApp, comp
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
"""
<utility
- component="Zope.ComponentArchitecture.tests.TestComponents.comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
+ component="zope.component.tests.components.comp"
+ provides="zope.component.tests.components.IApp"
/>
"""
)))
@@ -167,8 +162,7 @@
from zope.component import getUtility, queryUtility
# Full import is critical!
- from zope.component.tests.test_components \
- import IApp, comp
+ from zope.component.tests.components import IApp, comp
self.testUtility()
@@ -177,8 +171,8 @@
xmlconfig(StringIO(template % (
"""
<utility
- component="Zope.ComponentArchitecture.tests.TestComponents.comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
+ component="zope.component.tests.components.comp"
+ provides="zope.component.tests.components.IApp"
name="test"
/>
"""
@@ -190,16 +184,15 @@
from zope.component import getUtility, queryUtility
# Full import is critical!
- from zope.component.tests.test_components \
- import IApp, Comp
+ from zope.component.tests.components import IApp, Comp
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
"""
<utility
- factory="Zope.ComponentArchitecture.tests.TestComponents.Comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
+ factory="zope.component.tests.components.Comp"
+ provides="zope.component.tests.components.IApp"
/>
"""
)))
@@ -210,16 +203,15 @@
from zope.component import getUtility, queryUtility
# Full import is critical!
- from zope.component.tests.test_components \
- import IApp, comp
+ from zope.component.tests.components import IApp, comp
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
"""
<utility
- component="Zope.ComponentArchitecture.tests.TestComponents.comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
+ component="zope.component.tests.components.comp"
+ provides="zope.component.tests.components.IApp"
permission="Zope.Public"
/>
"""
@@ -234,8 +226,8 @@
config = StringIO(template % (
"""
<utility
- component="Zope.ComponentArchitecture.tests.TestComponents.comp"
- provides="Zope.ComponentArchitecture.tests.TestComponents.IApp"
+ component="zope.component.tests.components.comp"
+ provides="zope.component.tests.components.IApp"
permission="UndefinedPermission"
/>
"""
@@ -252,9 +244,9 @@
xmlconfig(StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
))
@@ -265,11 +257,11 @@
xmlconfig(StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
permission="Zope.Public"
- allowed_interface="Zope.ComponentArchitecture.tests.TestViews.IV"
+ allowed_interface="zope.component.tests.views.IV"
/>
"""
))
@@ -282,9 +274,9 @@
xmlconfig(StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
permission="Zope.Public"
allowed_attributes="action"
/>
@@ -299,12 +291,12 @@
xmlconfig(StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
permission="Zope.Public"
allowed_attributes="action"
- allowed_interface="Zope.ComponentArchitecture.tests.TestViews.IV"
+ allowed_interface="zope.component.tests.views.IV"
/>
"""
))
@@ -317,12 +309,12 @@
xmlconfig(StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
permission="Zope.Public"
allowed_attributes="action index"
- allowed_interface="Zope.ComponentArchitecture.tests.TestViews.IV"
+ allowed_interface="zope.component.tests.views.IV"
/>
"""
))
@@ -338,9 +330,9 @@
StringIO(template %
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
allowed_attributes="action index"
/>
"""
@@ -350,12 +342,12 @@
config = StringIO(template % (
"""
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"
permission="UndefinedPermission"
allowed_attributes="action index"
- allowed_interface="Zope.ComponentArchitecture.tests.TestViews.IV"
+ allowed_interface="zope.component.tests.views.IV"
/>
"""
))
@@ -372,9 +364,9 @@
xmlconfig(StringIO(template % (
"""
<defaultView name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
)))
@@ -390,8 +382,8 @@
xmlconfig(StringIO(template % (
"""
<defaultView name="test"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
)))
@@ -406,16 +398,16 @@
xmlconfig(StringIO(template % (
"""
<skin name="zmi" layers="zmi default"
- type="Zope.ComponentArchitecture.tests.TestViews.IV" />
+ type="zope.component.tests.views.IV" />
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.VZMI"
+ factory="zope.component.tests.views.VZMI"
layer="zmi"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
<view name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.V1"
- for="Zope.ComponentArchitecture.tests.TestViews.IC"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ factory="zope.component.tests.views.V1"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
)))
@@ -432,8 +424,8 @@
xmlconfig(StringIO(template % (
"""
<resource name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.R1"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ factory="zope.component.tests.views.R1"
+ type="zope.component.tests.views.IV"/>
"""
)))
@@ -446,8 +438,8 @@
config = StringIO(template % (
"""
<resource name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.R1"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"
+ factory="zope.component.tests.views.R1"
+ type="zope.component.tests.views.IV"
permission="UndefinedPermission"/>
"""
))
@@ -463,14 +455,14 @@
xmlconfig(StringIO(template % (
"""
<skin name="zmi" layers="zmi default"
- type="Zope.ComponentArchitecture.tests.TestViews.IV" />
+ type="zope.component.tests.views.IV" />
<resource name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.RZMI"
+ factory="zope.component.tests.views.RZMI"
layer="zmi"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ type="zope.component.tests.views.IV"/>
<resource name="test"
- factory="Zope.ComponentArchitecture.tests.TestViews.R1"
- type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ factory="zope.component.tests.views.R1"
+ type="zope.component.tests.views.IV"/>
"""
)))
@@ -489,19 +481,19 @@
"""
<factory
id="foo"
- component="Zope.ComponentArchitecture.tests.TestFactory.f"
+ component="zope.component.tests.factory.f"
/>
<factory
- component="Zope.ComponentArchitecture.tests.TestFactory.f"
+ component="zope.component.tests.factory.f"
/>
"""
)))
- from zope.component.tests.test_factory import X
+ from zope.component.tests.factory import X
self.assertEqual(createObject(None, 'foo').__class__, X)
self.assertEqual(createObject(
None,
- 'Zope.ComponentArchitecture.tests.TestFactory.f').__class__, X)
+ 'zope.component.tests.factory.f').__class__, X)
def test_suite():
=== Zope3/src/zope/app/component/tests/test_interfacefield.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/test_interfacefield.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/test_interfacefield.py Mon Dec 23 17:22:36 2002
@@ -18,11 +18,9 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.interface import Interface
-import zope.interface
+import zope.interface as InterfaceModule
from zope.app.component.interfacefield import InterfaceField
from zope.schema.interfaces import ValidationError
-
-
class Test(TestCase):
=== Zope3/src/zope/app/component/tests/test_servicedirective.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/test_servicedirective.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/test_servicedirective.py Mon Dec 23 17:22:36 2002
@@ -27,10 +27,9 @@
from zope.component.exceptions import ComponentLookupError
-from zope.app.component.tests.test_service \
- import IFooService, FooService
+from zope.app.component.tests.service import IFooService, FooService
-import Zope.App.ComponentArchitecture
+import zope.app.component
from zope.component import getService
from zope.app.tests.placelesssetup import PlacelessSetup
@@ -48,7 +47,7 @@
def setUp(self):
PlacelessSetup.setUp(self)
- XMLConfig('meta.zcml', Zope.App.ComponentArchitecture)()
+ XMLConfig('meta.zcml', zope.app.component)()
def testServiceConfigNoType(self):
from zope.component.service \
@@ -61,7 +60,7 @@
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.fooService"
+ zope.app.component.tests.service.fooService"
/>
"""
)))
@@ -76,17 +75,17 @@
"""
<serviceType id="Foo"
interface="
- Zope.App.ComponentArchitecture.tests.TestService.IFooService"
+ zope.app.component.tests.service.IFooService"
/>
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.fooService"
+ zope.app.component.tests.service.fooService"
/>
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.foo2"
+ zope.app.component.tests.service.foo2"
/>
"""
)))
@@ -98,12 +97,12 @@
"""
<serviceType id="Foo"
interface="
- Zope.App.ComponentArchitecture.tests.TestService.IFooService"
+ zope.app.component.tests.service.IFooService"
/>
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.fooService"
+ zope.app.component.tests.service.fooService"
/>
"""
)))
@@ -120,12 +119,12 @@
"""
<serviceType id="Foo"
interface="
- Zope.App.ComponentArchitecture.tests.TestService.IFooService"
+ zope.app.component.tests.service.IFooService"
/>
<service
serviceType="Foo"
factory="
- Zope.App.ComponentArchitecture.tests.TestService.FooService"
+ zope.app.component.tests.service.FooService"
/>
"""
)))
@@ -142,12 +141,12 @@
"""
<serviceType id="Foo"
interface="
- Zope.App.ComponentArchitecture.tests.TestService.IFooService"
+ zope.app.component.tests.service.IFooService"
/>
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.fooService"
+ zope.app.component.tests.service.fooService"
permission="Zope.Public"
/>
"""
@@ -168,19 +167,19 @@
<directive name="permission"
attributes="id title description"
handler="
- Zope.App.Security.Registries.metaConfigure.definePermission" />
+ zope.app.security.registries.metaconfigure.definePermission" />
</directives>
<permission id="XXX" title="xxx" />
<serviceType id="Foo"
interface="
- Zope.App.ComponentArchitecture.tests.TestService.IFooService"
+ zope.app.component.tests.service.IFooService"
/>
<service
serviceType="Foo"
component="
- Zope.App.ComponentArchitecture.tests.TestService.fooService"
+ zope.app.component.tests.service.fooService"
permission="XXX"
/>
"""
=== Removed File Zope3/src/zope/app/component/tests/test_service.py ===