[Zope-Checkins]
SVN: Zope/branches/2.9-layer-support/lib/python/Testing/
starting merge
david whitfield Morriss
whit at longnow.org
Fri Aug 18 22:33:50 EDT 2006
Log message for revision 69678:
starting merge
Changed:
A Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
A Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
A Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
A Zope/branches/2.9-layer-support/lib/python/Testing/tmp/
-=-
Added: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py
===================================================================
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py 2006-08-19 00:59:19 UTC (rev 69677)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/layer.py 2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,54 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""
+layer support for ZopeTestCase
+
+$Id: $
+"""
+import os
+from utils import setDebugMode
+
+class ZopeLiteLayer:
+ @classmethod
+ def setUp(cls):
+ import ZopeLite
+
+ @classmethod
+ def tearDown(cls):
+ raise NotImplementedError
+
+# products to install
+_products=[]
+
+# setup functions
+_z2_callables=[]
+class Zope2Layer(ZopeLiteLayer):
+ """ stacks upon ZopeLiteLayer and handles products installs """
+ @classmethod
+ def setUp(cls):
+ import ZopeLite as Zope2
+ install = Zope2.installProduct
+
+ [install(name, quiet=quiet) \
+ for name, quiet in _products]
+
+ [func(*args, **kw) for func, args, kw in _z2_callables]
+
+ @classmethod
+ def tearDown(cls):
+ raise NotImplementedError
+
+
+def installProduct(name, quiet=0):
+ if not (name, quiet) in _products:
+ _products.append((name, quiet))
Added: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py
===================================================================
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py 2006-08-19 00:59:19 UTC (rev 69677)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/tests.py 2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,15 @@
+import os, sys
+import unittest
+suite = unittest.TestSuite()
+
+def test_suite():
+ names = os.listdir(os.path.dirname(__file__))
+ tests = [x for x in names \
+ if x.startswith('test') and x.endswith('.py') and not x == 'tests.py']
+
+ for test in tests:
+ Testing = __import__("Testing.ZopeTestCase." + test[:-3])
+ testmodule = getattr(Testing.ZopeTestCase, test[:-3])
+ if hasattr(testmodule, 'test_suite'):
+ suite.addTest(testmodule.test_suite())
+ return suite
Added: Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
===================================================================
--- Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py 2006-08-19 00:59:19 UTC (rev 69677)
+++ Zope/branches/2.9-layer-support/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py 2006-08-19 02:33:50 UTC (rev 69678)
@@ -0,0 +1,15 @@
+import os, sys
+import unittest
+suite = unittest.TestSuite()
+
+def test_suite():
+ names = os.listdir(os.path.dirname(__file__))
+ tests = [x for x in names \
+ if x.startswith('test') and x.endswith('.py') and not x == 'tests.py']
+
+ for test in tests:
+ Testing = __import__("Testing.ZopeTestCase.zopedoctest." + test[:-3])
+ testmodule = getattr(Testing.ZopeTestCase.zopedoctest, test[:-3])
+ if hasattr(testmodule, 'test_suite'):
+ suite.addTest(testmodule.test_suite())
+ return suite
More information about the Zope-Checkins
mailing list