[CMF-checkins] CVS: CMF/CMFCore/tests/base - utils.py:1.3
Yvo Schubbe
y.2004_ at wcm-solutions.de
Mon Apr 26 04:55:51 EDT 2004
Update of /cvs-repository/CMF/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv32349/CMFCore/tests/base
Modified Files:
utils.py
Log Message:
- added optional 'suite_name' argument to build_test_suite()
- refactored all_cmf_tests and test_all to hide their test suites from other test runners
- added CMFActionIcons tests to all_cmf_tests
- removed pre Zope 2.6.4 compatibility code
- some whitespace, import and copyright cleanup
=== CMF/CMFCore/tests/base/utils.py 1.2 => 1.3 ===
--- CMF/CMFCore/tests/base/utils.py:1.2 Fri Feb 15 14:45:34 2002
+++ CMF/CMFCore/tests/base/utils.py Mon Apr 26 04:55:20 2004
@@ -1,22 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+""" CMF test utils.
+
+$Id$
+"""
+
from unittest import TestSuite
+
from sys import modules
-def build_test_suite(package_name,module_names,required=1):
+
+def build_test_suite(package_name, module_names, required=1,
+ suite_name='test_suite'):
"""
Utlitity for building a test suite from a package name
and a list of modules.
-
+
If required is false, then ImportErrors will simply result
in that module's tests not being added to the returned
suite.
"""
-
+
suite = TestSuite()
try:
for name in module_names:
the_name = package_name+'.'+name
__import__(the_name,globals(),locals())
- suite.addTest(modules[the_name].test_suite())
+ suite.addTest( getattr(modules[the_name], suite_name)() )
except ImportError:
if required:
raise
@@ -33,4 +53,3 @@
if catalog.getpath( rid ) == path:
return 1
return 0
-
More information about the CMF-checkins
mailing list