示例#1
0
optionParser = optparse.OptionParser(usage="%prog [options] testcaseDir",
                                     version="%prog 0.1")
optionParser.add_option(
    "-p",
    "--omit-prefix",
    dest="prefix",
    help="for file checks, prefix relative paths with this prefix",
    metavar="PREFIX")
optionParser.add_option("-o",
                        "--output",
                        dest="output",
                        help="write results to file (instead of stdout)",
                        metavar="OUTPUT")
(options, args) = optionParser.parse_args()

try:
    testdir = args[0]
except IndexError:
    optionParser.print_usage(sys.stderr)
    sys.exit(1)

out = sys.stdout
if options.output != None:
    out = file(options.output, 'wb')

writer = Writer(out)
try:
    runner = testrunner.TestRunner(testdir, options.prefix, writer)
    runner.run()
finally:
    writer.finalize()
示例#2
0
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Digia gives you certain additional
## rights.  These rights are described in the Digia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 3.0 as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL included in the
## packaging of this file.  Please review the following information to
## ensure the GNU General Public License version 3.0 requirements will be
## met: http://www.gnu.org/copyleft/gpl.html.
##
##
## $QT_END_LICENSE$
##
#############################################################################

import sys
from testrunner import testrunner

class Result:
    def addError( self, errstr ):
        print errstr
    

result = Result()
runner = testrunner.TestRunner( sys.argv[1], result )
runner.run()