[Checkins] SVN: van.testing/ Initial import
Brian Sutherland
jinty at web.de
Thu Nov 20 18:48:17 EST 2008
Log message for revision 93199:
Initial import
Changed:
A van.testing/
A van.testing/trunk/
A van.testing/trunk/CHANGES.txt
A van.testing/trunk/ZopePublicLicense.txt
A van.testing/trunk/buildout.cfg
A van.testing/trunk/setup.py
A van.testing/trunk/van/
A van.testing/trunk/van/__init__.py
A van.testing/trunk/van/testing/
A van.testing/trunk/van/testing/README.txt
A van.testing/trunk/van/testing/__init__.py
A van.testing/trunk/van/testing/layer.py
A van.testing/trunk/van/testing/tests.py
-=-
Added: van.testing/trunk/CHANGES.txt
===================================================================
--- van.testing/trunk/CHANGES.txt (rev 0)
+++ van.testing/trunk/CHANGES.txt 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,7 @@
+Changes
+=======
+
+1.0.0 (Unreleased)
+------------------
+
+- Initial Release
Property changes on: van.testing/trunk/CHANGES.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/ZopePublicLicense.txt
===================================================================
--- van.testing/trunk/ZopePublicLicense.txt (rev 0)
+++ van.testing/trunk/ZopePublicLicense.txt 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+ accompanying copyright notice, this list of conditions,
+ and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+ endorse or promote products derived from this software
+ without prior written permission from the copyright
+ holders.
+
+4. The right to distribute this software or to use it for
+ any purpose does not give you the right to use
+ Servicemarks (sm) or Trademarks (tm) of the copyright
+ holders. Use of them is covered by separate agreement
+ with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+ files to carry prominent notices stating that you changed
+ the files and the date of any change.
+
+Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
Property changes on: van.testing/trunk/ZopePublicLicense.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/buildout.cfg
===================================================================
--- van.testing/trunk/buildout.cfg (rev 0)
+++ van.testing/trunk/buildout.cfg 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,17 @@
+[buildout]
+parts=
+ test
+ deps
+develop=.
+interpreter = python
+extensions=
+ zc.buildoutsftp
+
+[deps]
+recipe = zc.recipe.egg
+eggs = van.testing
+ tl.eggdeps
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = van.testing
Added: van.testing/trunk/setup.py
===================================================================
--- van.testing/trunk/setup.py (rev 0)
+++ van.testing/trunk/setup.py 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas LLC.
+# 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.
+#
+##############################################################################
+
+import os
+from setuptools import setup, find_packages
+
+long_description = (
+ '.. contents::\n\n'
+ + open(os.path.join('van', 'testing', 'README.txt')).read()
+ + '\n\n'
+ + open(os.path.join('CHANGES.txt')).read()
+ )
+
+setup(name="van.testing",
+ version='1.0.0dev',
+ license = 'ZPL 2.1',
+ url = 'http://pypi.python.org/pypi/van.timeformat',
+ author="Vanguardistas LLC",
+ description="Layers for zope.testing to simplify test setups",
+ packages=find_packages(),
+ namespace_packages=["van"],
+ install_requires = [
+ 'setuptools',
+ 'zope.app.appsetup',
+ 'zope.testing',
+ ],
+ classifiers=[
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Topic :: Software Development :: Testing',
+ 'Development Status :: 5 - Production/Stable',
+ ],
+ long_description=long_description,
+ include_package_data = True,
+ zip_safe = False,
+ )
Property changes on: van.testing/trunk/setup.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/van/__init__.py
===================================================================
--- van.testing/trunk/van/__init__.py (rev 0)
+++ van.testing/trunk/van/__init__.py 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,3 @@
+# this is a namespace package
+import pkg_resources
+pkg_resources.declare_namespace(__name__)
Property changes on: van.testing/trunk/van/__init__.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/van/testing/README.txt
===================================================================
--- van.testing/trunk/van/testing/README.txt (rev 0)
+++ van.testing/trunk/van/testing/README.txt 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,26 @@
+Testing Utilities
+=================
+
+Layers
+------
+
+Some basic layers useful for making test setups.
+
+ >>> import os.path
+ >>> from van.testing.layer import zcml_layer, null_layer
+
+A zcml layer which sets up and tears down a zcml test harness (but is much
+simpler than that provided with zope.app.functional):
+
+ >>> class ZCMLLayer:
+ ... zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml')
+ >>> zcml_layer(ZCMLLayer)
+
+Some default layers are provided for use with zope.testing, a "null" layer that
+specifically does nothing. This is useful for layers which inherit from other
+layers but where you don't want setup/teardown functions run twice (is this a
+zope.testing bug?):
+
+ >>> class ExampleNullLayer(ZCMLLayer):
+ ... pass
+ >>> null_layer(ExampleNullLayer)
Property changes on: van.testing/trunk/van/testing/README.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/van/testing/__init__.py
===================================================================
--- van.testing/trunk/van/testing/__init__.py (rev 0)
+++ van.testing/trunk/van/testing/__init__.py 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,14 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas LLC.
+# 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.
+#
+##############################################################################
+
Property changes on: van.testing/trunk/van/testing/__init__.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/van/testing/layer.py
===================================================================
--- van.testing/trunk/van/testing/layer.py (rev 0)
+++ van.testing/trunk/van/testing/layer.py 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,90 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas LLC.
+# 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.
+#
+##############################################################################
+from zope.app.appsetup import config
+from zope.testing.cleanup import cleanUp
+
+def null_layer(layer):
+ """Sets up a class as a layer that doesn nothing.
+
+ Useful if you want a layer to inherit from other layers but not inherit
+ their methods. Inheriting the method can cause it to be triggered twice as
+ the zope testrunner (zope.testing) walks the super-classes of the layer
+ firing the setup methods.
+
+ >>> class LayerA:
+ ... @classmethod
+ ... def setUp(cls):
+ ... print 'fired'
+ ... @classmethod
+ ... def tearDown(cls):
+ ... print 'fired'
+ ... @classmethod
+ ... def testTearDown(cls):
+ ... print 'fired'
+ ... @classmethod
+ ... def testSetUp(cls):
+ ... print 'fired'
+
+ If we just subclass the method, then our subclass will inherit the methods:
+
+ >>> class LayerB(LayerA):
+ ... pass
+ >>> LayerB.setUp()
+ fired
+ >>> LayerB.tearDown()
+ fired
+ >>> LayerB.testSetUp()
+ fired
+ >>> LayerB.testTearDown()
+ fired
+
+ So, we override
+
+ >>> null_layer(LayerB)
+ >>> LayerB.setUp()
+ >>> LayerB.tearDown()
+ >>> LayerB.testSetUp()
+ >>> LayerB.testTearDown()
+ """
+ def null(cls):
+ pass
+ layer.setUp = classmethod(null)
+ layer.tearDown = layer.setUp
+ layer.testSetUp = layer.setUp
+ layer.testTearDown = layer.setUp
+
+
+def zcml_layer(layer):
+ """Sets up a class as a ZCMLLayer.
+
+ The class can have 2 attributes:
+ zcml: The site zcml file to load.
+ allow_teardown: Whether to allow teardown of this layer.
+ Default: True
+ """
+
+ def setUp(cls):
+ config(cls.zcml)
+ layer.setUp = classmethod(setUp)
+
+ def tearDown(cls):
+ cleanUp()
+ if not getattr(cls, 'allow_teardown', True):
+ raise NotImplementedError
+ layer.tearDown = classmethod(tearDown)
+
+ def null(cls):
+ pass
+ layer.testSetUp = classmethod(null)
+ layer.testTearDown = classmethod(null)
Property changes on: van.testing/trunk/van/testing/layer.py
___________________________________________________________________
Added: svn:eol-style
+ native
Added: van.testing/trunk/van/testing/tests.py
===================================================================
--- van.testing/trunk/van/testing/tests.py (rev 0)
+++ van.testing/trunk/van/testing/tests.py 2008-11-20 23:48:17 UTC (rev 93199)
@@ -0,0 +1,21 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas LLC.
+# 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.
+#
+##############################################################################
+import unittest
+import doctest
+
+def test_suite():
+ return unittest.TestSuite([
+ doctest.DocFileSuite('README.txt'),
+ doctest.DocTestSuite('van.testing.layer'),
+ ])
Property changes on: van.testing/trunk/van/testing/tests.py
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Checkins
mailing list