[Zope3-checkins] SVN: Zope3/trunk/src/zope/component/ Remove test
dependency on zope.app for zope.component.
Baiju M
baiju.m.mail at gmail.com
Sat Oct 7 04:49:59 EDT 2006
Log message for revision 70558:
Remove test dependency on zope.app for zope.component.
Changed:
A Zope3/trunk/src/zope/component/testfiles/
A Zope3/trunk/src/zope/component/testfiles/__init__.py
A Zope3/trunk/src/zope/component/testfiles/adapter.py
A Zope3/trunk/src/zope/component/testfiles/components.py
U Zope3/trunk/src/zope/component/zcml.txt
-=-
Added: Zope3/trunk/src/zope/component/testfiles/__init__.py
===================================================================
--- Zope3/trunk/src/zope/component/testfiles/__init__.py 2006-10-07 05:22:02 UTC (rev 70557)
+++ Zope3/trunk/src/zope/component/testfiles/__init__.py 2006-10-07 08:49:58 UTC (rev 70558)
@@ -0,0 +1 @@
+#Python package
Property changes on: Zope3/trunk/src/zope/component/testfiles/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: Zope3/trunk/src/zope/component/testfiles/adapter.py (from rev 70448, Zope3/trunk/src/zope/app/component/tests/adapter.py)
Copied: Zope3/trunk/src/zope/component/testfiles/components.py (from rev 70448, Zope3/trunk/src/zope/app/component/tests/components.py)
Modified: Zope3/trunk/src/zope/component/zcml.txt
===================================================================
--- Zope3/trunk/src/zope/component/zcml.txt 2006-10-07 05:22:02 UTC (rev 70557)
+++ Zope3/trunk/src/zope/component/zcml.txt 2006-10-07 08:49:58 UTC (rev 70558)
@@ -29,16 +29,16 @@
Adapters play a key role in the Component Architecture. In ZCML, they
are registered with the <adapter /> directive.
- >>> from zope.app.component.tests.adapter import A1, A2, A3, Handler
- >>> from zope.app.component.tests.adapter import I1, I2, I3, IS
- >>> from zope.app.component.tests.components import IContent, Content, Comp, comp
+ >>> from zope.component.testfiles.adapter import A1, A2, A3, Handler
+ >>> from zope.component.testfiles.adapter import I1, I2, I3, IS
+ >>> from zope.component.testfiles.components import IContent, Content, Comp, comp
Before we register the first test adapter, we can verify that adapter
lookup doesn't work yet:
>>> from zope.component.tests import clearZCML
>>> clearZCML()
- >>> from zope.app.component.tests.components import IApp
+ >>> from zope.component.testfiles.components import IApp
>>> IApp(Content(), None) is None
True
@@ -46,13 +46,13 @@
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... />''')
>>> IApp(Content()).__class__
- <class 'zope.app.component.tests.components.Comp'>
+ <class 'zope.component.testfiles.components.Comp'>
It is also possible to give adapters names. Then the combination of
required interface, provided interface and name makes the adapter
@@ -67,14 +67,14 @@
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... name="test"
... />''')
>>> zope.component.getAdapter(Content(), IApp, 'test').__class__
- <class 'zope.app.component.tests.components.Comp'>
+ <class 'zope.component.testfiles.components.Comp'>
Adapter factories
~~~~~~~~~~~~~~~~~
@@ -87,11 +87,11 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.adapter.A1
- ... zope.app.component.tests.adapter.A2
- ... zope.app.component.tests.adapter.A3"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.adapter.A1
+ ... zope.component.testfiles.adapter.A2
+ ... zope.component.testfiles.adapter.A3"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... />''')
The resulting adapter is an A3, around an A2, around an A1, around the
@@ -118,8 +118,8 @@
>>> runSnippet('''
... <adapter
... factory=""
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... />''')
Traceback (most recent call last):
...
@@ -139,18 +139,18 @@
True
>>> runSnippet('''
- ... <adapter factory="zope.app.component.tests.components.Comp" />''')
+ ... <adapter factory="zope.component.testfiles.components.Comp" />''')
>>> IApp(Content()).__class__
- <class 'zope.app.component.tests.components.Comp'>
+ <class 'zope.component.testfiles.components.Comp'>
Of course, if the adapter has no ``implements()`` declaration, ZCML
can't figure out what it provides:
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.adapter.A4"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.adapter.A4"
+ ... for="zope.component.testfiles.components.IContent"
... />''')
Traceback (most recent call last):
...
@@ -162,8 +162,8 @@
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.adapter.A5"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.adapter.A5"
+ ... for="zope.component.testfiles.components.IContent"
... />''')
Traceback (most recent call last):
...
@@ -176,9 +176,9 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.Content"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.Content"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... />''')
>>> content = Content()
@@ -206,11 +206,11 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1
- ... zope.app.component.tests.adapter.I2"
- ... provides="zope.app.component.tests.adapter.I3"
- ... factory="zope.app.component.tests.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1
+ ... zope.component.testfiles.adapter.I2"
+ ... provides="zope.component.testfiles.adapter.I3"
+ ... factory="zope.component.testfiles.adapter.A3"
... />''')
>>> content = Content()
@@ -229,8 +229,8 @@
>>> runSnippet('''
... <adapter
... for=""
- ... provides="zope.app.component.tests.adapter.I3"
- ... factory="zope.app.component.tests.adapter.A3"
+ ... provides="zope.component.testfiles.adapter.I3"
+ ... factory="zope.component.testfiles.adapter.A3"
... />''')
>>> a3 = zope.component.queryMultiAdapter((), I3)
@@ -244,7 +244,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <adapter factory="zope.app.component.tests.adapter.A3" />''')
+ ... <adapter factory="zope.component.testfiles.adapter.A3" />''')
>>> a3 = zope.component.queryMultiAdapter((content, a1, a2), I3)
>>> a3.__class__ is A3
@@ -257,12 +257,12 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1
- ... zope.app.component.tests.adapter.I2"
- ... provides="zope.app.component.tests.components.IApp"
- ... factory="zope.app.component.tests.adapter.A1
- ... zope.app.component.tests.adapter.A2"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1
+ ... zope.component.testfiles.adapter.I2"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... factory="zope.component.testfiles.adapter.A1
+ ... zope.component.testfiles.adapter.A2"
... />''')
Traceback (most recent call last):
...
@@ -275,9 +275,9 @@
>>> runSnippet('''
... <adapter
... for=""
- ... provides="zope.app.component.tests.components.IApp"
- ... factory="zope.app.component.tests.adapter.A1
- ... zope.app.component.tests.adapter.A2"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... factory="zope.component.testfiles.adapter.A1
+ ... zope.component.testfiles.adapter.A2"
... />''')
Traceback (most recent call last):
...
@@ -305,9 +305,9 @@
... description="Allow XY."
... />
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... permission="y.x"
... />''')
@@ -315,7 +315,7 @@
appropriate permissions can be found from the context:
>>> IApp(Content()).__class__
- <class 'zope.app.component.tests.components.Comp'>
+ <class 'zope.component.testfiles.components.Comp'>
>>> type(IApp(Content()))
<class 'zope.location.location.LocationProxy'>
@@ -329,9 +329,9 @@
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... permission="zope.Public"
... />''')
@@ -352,7 +352,7 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
+ ... factory="zope.component.testfiles.components.Comp"
... permission="zope.Public"
... />''')
@@ -367,11 +367,11 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.adapter.A3"
- ... provides="zope.app.component.tests.adapter.I3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1
- ... zope.app.component.tests.adapter.I2"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... provides="zope.component.testfiles.adapter.I3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1
+ ... zope.component.testfiles.adapter.I2"
... permission="zope.Public"
... />''')
@@ -391,9 +391,9 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
- ... for="zope.app.component.tests.components.IContent"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
+ ... for="zope.component.testfiles.components.IContent"
... permission="zope.UndefinedPermission"
... />''')
Traceback (most recent call last):
@@ -414,9 +414,9 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.IContent"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.IContent"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... trusted="yes"
... />''')
@@ -454,9 +454,9 @@
... description="Allow XY."
... />
... <adapter
- ... for="zope.app.component.tests.components.IContent"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.IContent"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... permission="y.x"
... trusted="yes"
... />''')
@@ -490,9 +490,9 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.IContent"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.IContent"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... permission="zope.Public"
... trusted="yes"
... />''')
@@ -513,9 +513,9 @@
>>> clearZCML()
>>> runSnippet('''
... <adapter
- ... for="zope.app.component.tests.components.IContent"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.IContent"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... trusted="yes"
... locate="yes"
... />''')
@@ -541,10 +541,10 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... />''')
>>> content = Content()
@@ -575,16 +575,16 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... />
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A2"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A2"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... />''')
>>> subscribers = zope.component.subscribers((content, a1), IS)
@@ -604,8 +604,8 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
... />''')
>>> content = Content()
@@ -623,7 +623,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <subscriber handler="zope.app.component.tests.adapter.A3" />''')
+ ... <subscriber handler="zope.component.testfiles.adapter.A3" />''')
>>> sm = zope.component.getSiteManager()
>>> a3 = sm.adapters.subscriptions((IContent, I1, I2), None)[0]
@@ -636,9 +636,9 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... for="zope.app.component.tests.components.Content"
- ... provides="zope.app.component.tests.adapter.I1"
- ... factory="zope.app.component.tests.adapter.A1"
+ ... for="zope.component.testfiles.components.Content"
+ ... provides="zope.component.testfiles.adapter.I1"
+ ... factory="zope.component.testfiles.adapter.A1"
... />''')
>>> subs = list(zope.component.subscribers((Content(),), I1))
@@ -667,10 +667,10 @@
... description="Allow XY."
... />
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... permission="y.x"
... />''')
@@ -695,10 +695,10 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... trusted="yes"
... />''')
@@ -734,10 +734,10 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... provides="zope.app.component.tests.adapter.IS"
- ... factory="zope.app.component.tests.adapter.A3"
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
+ ... provides="zope.component.testfiles.adapter.IS"
+ ... factory="zope.component.testfiles.adapter.A3"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
... trusted="yes"
... locate="yes"
... />''')
@@ -779,9 +779,9 @@
>>> clearZCML()
>>> runSnippet('''
... <subscriber
- ... for="zope.app.component.tests.components.IContent
- ... zope.app.component.tests.adapter.I1"
- ... handler="zope.app.component.tests.adapter.Handler"
+ ... for="zope.component.testfiles.components.IContent
+ ... zope.component.testfiles.adapter.I1"
+ ... handler="zope.component.testfiles.adapter.Handler"
... />''')
In this case, simply getting the subscribers is enough to invoke them:
@@ -810,8 +810,8 @@
>>> runSnippet('''
... <utility
- ... component="zope.app.component.tests.components.comp"
- ... provides="zope.app.component.tests.components.IApp"
+ ... component="zope.component.testfiles.components.comp"
+ ... provides="zope.component.testfiles.components.IApp"
... />''')
>>> zope.component.getUtility(IApp) is comp
True
@@ -830,8 +830,8 @@
>>> runSnippet('''
... <utility
- ... component="zope.app.component.tests.components.comp"
- ... provides="zope.app.component.tests.components.IApp"
+ ... component="zope.component.testfiles.components.comp"
+ ... provides="zope.component.testfiles.components.IApp"
... name="test"
... />''')
>>> zope.component.getUtility(IApp, 'test') is comp
@@ -848,8 +848,8 @@
>>> runSnippet('''
... <utility
- ... factory="zope.app.component.tests.components.Comp"
- ... provides="zope.app.component.tests.components.IApp"
+ ... factory="zope.component.testfiles.components.Comp"
+ ... provides="zope.component.testfiles.components.IApp"
... />''')
>>> zope.component.getUtility(IApp).__class__ is Comp
True
@@ -865,7 +865,7 @@
True
>>> runSnippet('''
- ... <utility component="zope.app.component.tests.components.comp" />''')
+ ... <utility component="zope.component.testfiles.components.comp" />''')
>>> zope.component.getUtility(IApp) is comp
True
@@ -874,7 +874,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <utility component="zope.app.component.tests.adapter.a4" />''')
+ ... <utility component="zope.component.testfiles.adapter.a4" />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-4.61
@@ -885,7 +885,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <utility component="zope.app.component.tests.adapter.a5" />''')
+ ... <utility component="zope.component.testfiles.adapter.a5" />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-4.61
@@ -895,7 +895,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <utility component="zope.app.component.tests.adapter.A4" />''')
+ ... <utility component="zope.component.testfiles.adapter.A4" />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-4.61
@@ -903,7 +903,7 @@
>>> clearZCML()
>>> runSnippet('''
- ... <utility component="zope.app.component.tests.adapter.A5" />''')
+ ... <utility component="zope.component.testfiles.adapter.A5" />''')
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-4.61
@@ -924,14 +924,14 @@
'''
<permission id="tell.everyone" title="Yay" />
<utility
- component="zope.app.component.tests.components.comp"
- provides="zope.app.component.tests.components.IApp"
+ component="zope.component.testfiles.components.comp"
+ provides="zope.component.testfiles.components.IApp"
permission="tell.everyone"
/>
<permission id="top.secret" title="shhhh" />
<utility
- component="zope.app.component.tests.components.comp"
- provides="zope.app.component.tests.components.IAppb"
+ component="zope.component.testfiles.components.comp"
+ provides="zope.component.testfiles.components.IAppb"
permission="top.secret"
/>
'''
@@ -948,8 +948,8 @@
config = StringIO(template % (
'''
<utility
- component="zope.app.component.tests.components.comp"
- provides="zope.app.component.tests.components.IApp"
+ component="zope.component.testfiles.components.comp"
+ provides="zope.component.testfiles.components.IApp"
permission="zope.UndefinedPermission"
/>
'''
More information about the Zope3-Checkins
mailing list