diff options
author | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-25 10:57:45 +0000 |
---|---|---|
committer | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-25 10:57:45 +0000 |
commit | 09f7afd9909d9a6e5b6c0d148e2e8ba62648dc78 (patch) | |
tree | 77ba45693d6575698efeb2bd36d59daafefed0a6 /python/tests/tests.py | |
parent | 9d460cf67c3999a0ec7723c377a60df07268b5c8 (diff) | |
download | lasso-09f7afd9909d9a6e5b6c0d148e2e8ba62648dc78.tar.gz lasso-09f7afd9909d9a6e5b6c0d148e2e8ba62648dc78.tar.xz lasso-09f7afd9909d9a6e5b6c0d148e2e8ba62648dc78.zip |
Added a --source-dir option to tests.
Diffstat (limited to 'python/tests/tests.py')
-rwxr-xr-x | python/tests/tests.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/python/tests/tests.py b/python/tests/tests.py index a8e902b4..a1913e01 100755 --- a/python/tests/tests.py +++ b/python/tests/tests.py @@ -24,7 +24,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +import __builtin__ import imp +from optparse import OptionParser +import os import sys import time import unittest @@ -42,7 +45,19 @@ testSuites = ( 'errorchecking_tests', ) -if "--xml" in sys.argv: + +# Parse command line options. +parser = OptionParser() +parser.add_option( + '-x', '--xml', dest = 'xmlMode', help = 'enable XML output', + action = 'store_true', default = False) +parser.add_option( + '-s', '--source-dir', dest = 'srcDir', help = 'path of source directory', + metavar = 'DIR', default = os.getcwd()) +(options, args) = parser.parse_args() +__builtin__.__dict__['dataDir'] = os.path.join(options.srcDir, '../../tests/data') + +if options.xmlMode: print """<?xml version="1.0"?>""" print """<testsuites xmlns="http://check.sourceforge.net/ns">""" print """ <title>Python Bindings</title>""" @@ -65,7 +80,7 @@ for testSuite in testSuites: else: doc = testSuite - if "--xml" in sys.argv: + if options.xmlMode: runner = XmlTestRunner() else: runner = unittest.TextTestRunner(verbosity=2) @@ -76,7 +91,7 @@ for testSuite in testSuites: result = runner.run(module.allTests) success = success and result.wasSuccessful() -if "--xml" in sys.argv: +if options.xmlMode: print """</testsuites>""" sys.exit(not success) |