#!<> ############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """Run tests in a SchoolTool instance home. $Id$ """ import sys, os import site # Check the minimum python version if sys.version_info < (2, 4): print >> sys.stderr, '%s: need Python 2.4 or later.' % sys.argv[0] print >> sys.stderr, 'Your python is %s' % sys.version sys.exit(1) here = os.path.dirname(os.path.realpath(__file__)) here = os.path.dirname(here) SOFTWARE_HOME = r"<>" instance_lib = os.path.join(here, "lib", "python") sys.path[:0] = [instance_lib, SOFTWARE_HOME] site.addsitedir(SOFTWARE_HOME) site.addsitedir(instance_lib) from zope.testing import testrunner defaults = ['--tests-pattern', '^f?tests$'] test_lib = instance_lib if testschooltool = "--testschooltool" in sys.argv[1:]: sys.argv.remove("--testschooltool") test_lib = SOFTWARE_HOME # We only want to run schooltool tests defaults += ['-m', 'schooltool'] defaults += ['-test-path', test_lib] # Add our extra option to the help of the testrunner. testrunner.searching.add_option("--testschooltool", help="""\ When specified, the tests for the installed SchoolTool software are run instead of the tests for the software installed in the instance. This is useful to determine the effects of additional software installation and configuration changes on the base Zope software. Unlike other options, this cannot be abbreviated. """ sys.exit(testrunner.run(defaults))