[Checkins] SVN: z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/ Add a complete test package with functional tests.

Uli Fouquet uli at gnufix.de
Mon May 4 10:44:40 EDT 2009


Log message for revision 99708:
  Add a complete test package with functional tests.

Changed:
  A   z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/
  A   z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/__init__.py
  A   z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/afunctionaldoctest.txt
  A   z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/configure.zcml
  A   z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/ftesting.zcml

-=-
Added: z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/__init__.py
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/__init__.py	                        (rev 0)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/__init__.py	2009-05-04 14:44:39 UTC (rev 99708)
@@ -0,0 +1,14 @@
+"""A utility that should be registered only with local ftesting.zcml.
+"""
+import zope.interface
+
+class IFoo(zope.interface.Interface):
+    def do_foo():
+        pass
+
+
+class FooUtility(object):
+    zope.interface.implements(IFoo)
+
+    def do_foo(self):
+        print "Foo!"

Added: z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/afunctionaldoctest.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/afunctionaldoctest.txt	                        (rev 0)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/afunctionaldoctest.txt	2009-05-04 14:44:39 UTC (rev 99708)
@@ -0,0 +1,16 @@
+
+:doctest:
+:functional-zcml-layer: ftesting.zcml
+
+Only our local ftesting.zcml is considered during test runs:
+
+    >>> from zope.component import getUtility
+    >>> from z3c.testsetup.tests.layered_cave.foo import IFoo
+    >>> getUtility(IFoo, name='foo utility')().do_foo()
+    Foo!
+
+    >>> from z3c.testsetup.tests.layered_cave.bar import IBar
+    >>> getUtility(IBar, name='bar utility')
+    Traceback (most recent call last):
+    ...
+    ComponentLookupError: (<InterfaceClass ...bar.IBar>, 'bar utility')

Added: z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/configure.zcml
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/configure.zcml	                        (rev 0)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/configure.zcml	2009-05-04 14:44:39 UTC (rev 99708)
@@ -0,0 +1,4 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+  <include package="zope.component" file="meta.zcml" />
+  <utility component=".FooUtility" provides=".IFoo" name="foo utility" />
+</configure>

Added: z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/ftesting.zcml
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/ftesting.zcml	                        (rev 0)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/layered_cave/foo/ftesting.zcml	2009-05-04 14:44:39 UTC (rev 99708)
@@ -0,0 +1,3 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+  <include package="z3c.testsetup.tests.layered_cave.foo" />
+</configure>



More information about the Checkins mailing list