diff options
author | bubulle <bubulle@alioth.debian.org> | 2011-11-12 13:00:54 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2011-11-12 13:00:54 +0000 |
commit | 6fba685eec3a1165ec0b82d72d3ae71e946a1404 (patch) | |
tree | f3c0543c8f9df4a22ed62e3bd99d9d7bc1054c14 /source4/scripting/bin/subunitrun | |
parent | 77a7925c0509068d5cd2affd94a3996d0a86035a (diff) | |
download | samba-6fba685eec3a1165ec0b82d72d3ae71e946a1404.tar.gz |
Merge upstream 3.6.1 source
git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@3972 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source4/scripting/bin/subunitrun')
-rwxr-xr-x | source4/scripting/bin/subunitrun | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun index 62717a78a9..bc7b42c610 100755 --- a/source4/scripting/bin/subunitrun +++ b/source4/scripting/bin/subunitrun @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Simple subunit testrunner for python # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007 @@ -21,27 +21,33 @@ import sys # Find right directory when running from source tree sys.path.insert(0, "bin/python") -sys.path.insert(1, "../lib/subunit/python") -from subunit import SubunitTestRunner -from unittest import TestProgram import optparse -import os -from samba import param +import samba +samba.ensure_external_module("testtools", "testtools") +samba.ensure_external_module("subunit", "subunit/python") +from subunit.run import SubunitTestRunner import samba.getopt as options import samba.tests + parser = optparse.OptionParser("subunitrun [options] <tests>") credopts = options.CredentialsOptions(parser) parser.add_option_group(credopts) -sambaopts = options.SambaOptions(parser) -parser.add_option_group(sambaopts) -parser.add_option_group(options.VersionOptions(parser)) - -args = parser.parse_args()[1] - -samba.tests.cmdline_loadparm = sambaopts.get_loadparm() -samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.cmdline_loadparm) +try: + from subunit.run import TestProgram +except ImportError: + from unittest import TestProgram +else: + parser.add_option('-l', '--list', dest='listtests', default=False, + help='List tests rather than running them.', + action="store_true") + +opts, args = parser.parse_args() + +samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.env_loadparm()) +if getattr(opts, "listtests", False): + args.insert(0, "--list") runner = SubunitTestRunner() program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner) |