[Zope-CVS] CVS: Packages/JobBoardEx/tests - __init__.py:1.3
Jim Fulton
jim@zope.com
Tue, 11 Jun 2002 16:07:47 -0400
Update of /cvs-repository/Packages/JobBoardEx/tests
In directory cvs.zope.org:/tmp/cvs-serv26369/tests
Modified Files:
__init__.py
Log Message:
Jim and Guido redid (nearly) from scratch using new ZCML/Zope3-isms
and a simpler design.
Guido plans to clean this up.
=== Packages/JobBoardEx/tests/__init__.py 1.2 => 1.3 ===
-
-import glob
-import os.path
-import sys
-import unittest
-
-def alltests():
- """Return a suite containing all the tests defined for this package.
-
- This is useful with the unittestgui.py script (at least).
- """
- mydir = os.path.dirname(__file__)
- files = glob.glob(os.path.join(mydir, "*.py"))
- suites = []
- for file in files:
- base = os.path.splitext(os.path.basename(file))[0]
- if not base.startswith("test"):
- continue
- modname = "%s.%s" % (__name__, base)
- __import__(modname)
- module = sys.modules[modname]
- try:
- tsfunc = module.test_suite
- except AttributeError:
- pass
- else:
- suites.append(tsfunc())
- if len(suites) == 1:
- return suites[0]
- elif len(suites) == 0:
- return
- else:
- return unittest.TestSuite(suites)