[Checkins] SVN: z3c.unconfigure/trunk/src/z3c/unconfigure/test
Refactor tests: create 'tests' subpackage and split up
tests.txt into multiple
Philipp von Weitershausen
philikon at philikon.de
Wed Aug 6 11:38:18 EDT 2008
Log message for revision 89445:
Refactor tests: create 'tests' subpackage and split up tests.txt into multiple
docfilesuites
Changed:
D z3c.unconfigure/trunk/src/z3c/unconfigure/testfixtures/
U z3c.unconfigure/trunk/src/z3c/unconfigure/testing.py
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/__init__.py
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/handlers.py
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/overrides2.zcml
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/overrides.txt
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/subscribers.txt
A z3c.unconfigure/trunk/src/z3c/unconfigure/tests/test_all.py
D z3c.unconfigure/trunk/src/z3c/unconfigure/tests.py
D z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt
-=-
Modified: z3c.unconfigure/trunk/src/z3c/unconfigure/testing.py
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/testing.py 2008-08-06 15:36:56 UTC (rev 89444)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/testing.py 2008-08-06 15:38:17 UTC (rev 89445)
@@ -67,7 +67,7 @@
context, "lolcat", ILolCat, lolcat, namespace="*")
source = '''\
-<configure package="z3c.unconfigure.testfixtures">
+<configure package="z3c.unconfigure.tests.fixtures">
%s
</configure>''' % source
@@ -75,12 +75,12 @@
def cat(filename):
here = os.path.dirname(__file__)
- filename = os.path.join(here, 'testfixtures', filename)
+ filename = os.path.join(here, 'tests', 'fixtures', filename)
print open(filename).read()
def DocFileSuite(filename):
return doctest.DocFileSuite(filename,
- package='z3c.unconfigure',
+ package='z3c.unconfigure.tests',
globs={'zcml': zcml,
'cat': cat},
tearDown=tearDown,
Added: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/__init__.py
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/__init__.py (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/__init__.py 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1 @@
+# Make this directory a package
Property changes on: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures (from rev 89430, z3c.unconfigure/trunk/src/z3c/unconfigure/testfixtures)
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/handlers.py (from rev 89444, z3c.unconfigure/trunk/src/z3c/unconfigure/testfixtures/handlers.py)
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/handlers.py (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/handlers.py 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1,21 @@
+from zope.component import adapter
+
+class Event(object):
+ pass
+
+ at adapter(Event)
+def regular(event):
+ print "Regular subscriber"
+
+ at adapter(Event)
+def trusted(event):
+ print "Trusted subscriber"
+
+ at adapter(Event)
+def located(event):
+ print "Located subscriber"
+
+ at adapter(Event)
+def locatedtrusted(event):
+ print "Located trusted subscriber"
+
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/overrides2.zcml (from rev 89444, z3c.unconfigure/trunk/src/z3c/unconfigure/testfixtures/overrides2.zcml)
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/overrides2.zcml (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/fixtures/overrides2.zcml 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1,6 @@
+<configure>
+ <lolcat who="I" canhas="hamburger" />
+ <unconfigure>
+ <print msg="LOL!" />
+ </unconfigure>
+</configure>
\ No newline at end of file
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/overrides.txt (from rev 89442, z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt)
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/overrides.txt (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/overrides.txt 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1,43 @@
+Unconfiguration and other overrides
+-----------------------------------
+
+When placing an ``unconfigure`` grouping directive in an overrides
+file together with other overrides, things should continue to work
+like you'd expect: the overrides directives override things and the
+``unconfigure`` directive filters actions.
+
+Let's consider this configuration:
+
+ >>> cat('lolcat.zcml')
+ <configure>
+ <print msg="Hello World!" />
+ <print msg="Important configuration here." />
+ <lolcat who="I" canhas="cheezburger" />
+ <print msg="Goodbye World!" />
+ <print msg="LOL!" />
+ <print msg="This is the last directive" />
+ </configure>
+
+And a file with one override and one "unconfiguration":
+
+ >>> cat('overrides2.zcml')
+ <configure>
+ <lolcat who="I" canhas="hamburger" />
+ <unconfigure>
+ <print msg="LOL!" />
+ </unconfigure>
+ </configure>
+
+It works as you'd expect:
+
+ >>> zcml("""
+ ... <configure>
+ ... <include file="lolcat.zcml" />
+ ... <includeOverrides file="overrides2.zcml" />
+ ... </configure>
+ ... """)
+ Hello World!
+ Important configuration here.
+ Goodbye World!
+ This is the last directive
+ I can has hamburger?
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/subscribers.txt (from rev 89442, z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt)
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/subscribers.txt (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/subscribers.txt 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1,36 @@
+Unconfiguring event handlers
+----------------------------
+
+This package also supports unconfiguring event handlers.
+
+ >>> import zope.component.eventtesting
+ >>> zope.component.eventtesting.setUp()
+
+Consider a bunch of event handlers configured in various ways:
+
+ >>> zcml("""
+ ... <configure xmlns="http://namespaces.zope.org/zope">
+ ... <include package="zope.component" file="meta.zcml" />
+ ...
+ ... <subscriber handler=".handlers.regular" />
+ ... <subscriber handler=".handlers.trusted" trusted="yes" />
+ ... <subscriber handler=".handlers.located" locate="yes" />
+ ... <subscriber handler=".handlers.locatedtrusted"
+ ... trusted="yes" locate="yes" />
+ ...
+ ... <unconfigure>
+ ... <subscriber handler=".handlers.regular" />
+ ... <subscriber handler=".handlers.trusted" trusted="yes" />
+ ... <subscriber handler=".handlers.located" locate="yes" />
+ ... <subscriber handler=".handlers.locatedtrusted"
+ ... trusted="yes" locate="yes" />
+ ... </unconfigure>
+ ... </configure>
+ ... """)
+
+Since we've unconfigured the handlers, we expect that nothing will
+happen when we send the event:
+
+ >>> from zope.event import notify
+ >>> from z3c.unconfigure.tests.fixtures.handlers import Event
+ >>> notify(Event())
Copied: z3c.unconfigure/trunk/src/z3c/unconfigure/tests/test_all.py (from rev 89443, z3c.unconfigure/trunk/src/z3c/unconfigure/tests.py)
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests/test_all.py (rev 0)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests/test_all.py 2008-08-06 15:38:17 UTC (rev 89445)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Tests
+"""
+import unittest
+from z3c.unconfigure.testing import DocFileSuite
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(DocFileSuite('../README.txt'))
+ suite.addTest(DocFileSuite('overrides.txt'))
+ suite.addTest(DocFileSuite('subscribers.txt'))
+ return suite
Deleted: z3c.unconfigure/trunk/src/z3c/unconfigure/tests.py
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests.py 2008-08-06 15:36:56 UTC (rev 89444)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests.py 2008-08-06 15:38:17 UTC (rev 89445)
@@ -1,23 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (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.
-#
-##############################################################################
-"""Tests
-"""
-import unittest
-from z3c.unconfigure.testing import DocFileSuite
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(DocFileSuite('README.txt'))
- suite.addTest(DocFileSuite('tests.txt'))
- return suite
Deleted: z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt
===================================================================
--- z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt 2008-08-06 15:36:56 UTC (rev 89444)
+++ z3c.unconfigure/trunk/src/z3c/unconfigure/tests.txt 2008-08-06 15:38:17 UTC (rev 89445)
@@ -1,88 +0,0 @@
-Tests that are not documentation
-================================
-
-Unconfiguration and other overrides
------------------------------------
-
-When placing an ``unconfigure`` grouping directive in an overrides
-file together with other overrides, things should continue to work
-like you'd expect: the overrides directives override things and the
-``unconfigure`` directive filters actions.
-
-Let's consider this configuration:
-
- >>> cat('lolcat.zcml')
- <configure>
- <print msg="Hello World!" />
- <print msg="Important configuration here." />
- <lolcat who="I" canhas="cheezburger" />
- <print msg="Goodbye World!" />
- <print msg="LOL!" />
- <print msg="This is the last directive" />
- </configure>
-
-And a file with one override and one "unconfiguration":
-
- >>> cat('overrides2.zcml')
- <configure>
- <lolcat who="I" canhas="hamburger" />
- <unconfigure>
- <print msg="LOL!" />
- </unconfigure>
- </configure>
-
-It works as you'd expect:
-
- >>> zcml("""
- ... <configure>
- ... <include file="lolcat.zcml" />
- ... <includeOverrides file="overrides2.zcml" />
- ... </configure>
- ... """)
- Hello World!
- Important configuration here.
- Goodbye World!
- This is the last directive
- I can has hamburger?
-
-
-Unconfiguring event handlers
-----------------------------
-
-This package also supports unconfiguring event handlers.
-
- >>> import zope.component.eventtesting
- >>> zope.component.eventtesting.setUp()
-
-Consider a bunch of event handlers configured in various ways:
-
- >>> zcml("""
- ... <configure xmlns="http://namespaces.zope.org/zope">
- ... <include package="zope.component" file="meta.zcml" />
- ...
- ... <subscriber handler=".handlers.regular" />
- ... <subscriber handler=".handlers.trusted" trusted="yes" />
- ... <subscriber handler=".handlers.located" locate="yes" />
- ... <subscriber handler=".handlers.locatedtrusted"
- ... trusted="yes" locate="yes" />
- ...
- ... <unconfigure>
- ... <subscriber handler=".handlers.regular" />
- ... <subscriber handler=".handlers.trusted" trusted="yes" />
- ... <subscriber handler=".handlers.located" locate="yes" />
- ... <subscriber handler=".handlers.locatedtrusted"
- ... trusted="yes" locate="yes" />
- ... </unconfigure>
- ... </configure>
- ... """)
-
-Since we've unconfigured the handlers, we expect that nothing will
-happen when we send the event:
-
- >>> from zope.event import notify
- >>> from z3c.unconfigure.testfixtures.handlers import Event
- >>> notify(Event())
-
- >>> import zope.testing.cleanup
- >>> zope.testing.cleanup.cleanUp()
-
More information about the Checkins
mailing list