[Checkins] SVN: five.resourceinclude/trunk/ - Add buildout and boilerplate to be able to add tests.
Sylvain Viollon
sylvain at infrae.com
Tue Aug 26 18:05:54 EDT 2008
Log message for revision 90370:
- Add buildout and boilerplate to be able to add tests.
Changed:
A five.resourceinclude/trunk/bootstrap.py
A five.resourceinclude/trunk/buildout.cfg
A five.resourceinclude/trunk/devel/
A five.resourceinclude/trunk/devel/EXTERNALS.txt
A five.resourceinclude/trunk/src/five/resourceinclude/testing.py
A five.resourceinclude/trunk/src/five/resourceinclude/tests/test_zcml.py
-=-
Added: five.resourceinclude/trunk/bootstrap.py
===================================================================
--- five.resourceinclude/trunk/bootstrap.py (rev 0)
+++ five.resourceinclude/trunk/bootstrap.py 2008-08-26 22:05:54 UTC (rev 90370)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 85745 2008-04-26 08:49:56Z regebro $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+ import pkg_resources
+except ImportError:
+ ez = {}
+ exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+ import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Added: five.resourceinclude/trunk/buildout.cfg
===================================================================
--- five.resourceinclude/trunk/buildout.cfg (rev 0)
+++ five.resourceinclude/trunk/buildout.cfg 2008-08-26 22:05:54 UTC (rev 90370)
@@ -0,0 +1,35 @@
+[buildout]
+parts =
+ zope2
+ instance
+ test
+develop = .
+ devel/z3c.resourceinclude
+
+newest = false
+
+[zope2]
+recipe = plone.recipe.zope2install
+url = http://www.zope.org/Products/Zope/2.11.1/Zope-2.11.1-final.tgz
+fake-zope-eggs = true
+skip-fake-eggs =
+ zope.component
+ zope.testing
+
+[instance]
+recipe = plone.recipe.zope2instance
+zope2-location = ${zope2:location}
+user = admin:admin
+http-address = 8080
+debug-mode = on
+verbose-security = on
+eggs =
+ five.resourceinclude
+zcml = five.resourceinclude:meta.zcml
+ five.resourceinclude
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = ${instance:eggs}
+extra-paths = ${zope2:location}/lib/python
+defaults = ['-m', 'five.resourceinclude', '--tests-pattern', '^f?tests$', '-v']
Property changes on: five.resourceinclude/trunk/devel
___________________________________________________________________
Name: svn:externals
+ # svn propset svn:externals -F EXTERNALS.txt .
z3c.resouceinclude svn://svn.zope.org/repos/main/z3c.resourceinclude/trunk
Added: five.resourceinclude/trunk/devel/EXTERNALS.txt
===================================================================
--- five.resourceinclude/trunk/devel/EXTERNALS.txt (rev 0)
+++ five.resourceinclude/trunk/devel/EXTERNALS.txt 2008-08-26 22:05:54 UTC (rev 90370)
@@ -0,0 +1,2 @@
+# svn propset svn:externals -F EXTERNALS.txt .
+z3c.resouceinclude svn://svn.zope.org/repos/main/z3c.resourceinclude/trunk
Added: five.resourceinclude/trunk/src/five/resourceinclude/testing.py
===================================================================
--- five.resourceinclude/trunk/src/five/resourceinclude/testing.py (rev 0)
+++ five.resourceinclude/trunk/src/five/resourceinclude/testing.py 2008-08-26 22:05:54 UTC (rev 90370)
@@ -0,0 +1,39 @@
+
+from zope.app.testing.placelesssetup import tearDown as _cleanUp
+def cleanUp():
+ """Cleans up the component architecture.
+ """
+ _cleanUp()
+ import Products.Five.zcml as zcml
+ zcml._initialized = 0
+
+def setDebugMode(mode):
+ """Allows manual setting of Five's inspection of debug mode
+ to allow for ZCML to fail meaningfully.
+ """
+ import Products.Five.fiveconfigure as fc
+ fc.debug_mode = mode
+
+import five.resourceinclude
+def loadSite():
+ """Loads extension.
+ """
+ cleanUp()
+ setDebugMode(1)
+ import Products.Five.zcml as zcml
+ zcml.load_site()
+ zcml.load_config('meta.zcml', five.resourceinclude)
+ zcml.load_config('configure.zcml', five.resourceinclude)
+ setDebugMode(0)
+
+
+class ResourceIncludeLayer(object):
+
+ @classmethod
+ def setUp(self):
+ loadSite()
+
+ @classmethod
+ def tearDown(self):
+ cleanUp()
+
Added: five.resourceinclude/trunk/src/five/resourceinclude/tests/test_zcml.py
===================================================================
--- five.resourceinclude/trunk/src/five/resourceinclude/tests/test_zcml.py (rev 0)
+++ five.resourceinclude/trunk/src/five/resourceinclude/tests/test_zcml.py 2008-08-26 22:05:54 UTC (rev 90370)
@@ -0,0 +1,23 @@
+
+
+import unittest
+from Testing import ZopeTestCase
+
+from five.resourceinclude.testing import ResourceIncludeLayer
+
+class ResourceIncludeTest(ZopeTestCase.FunctionalTestCase):
+
+ layer = ResourceIncludeLayer
+
+ def test_me(self):
+ pass
+
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(ResourceIncludeTest))
+ return suite
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
More information about the Checkins
mailing list