summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-10-20 13:24:04 +1100
committerAndrew Tridgell <tridge@samba.org>2011-10-20 04:23:07 +0200
commit43e5592e9af95f2f2522cf8b015a76b14475729d (patch)
tree6bca0e46e6814b70ca354c505ce2dfacaafb55d8
parent019f643c693b4c6de3da78159d8c4507b924d93a (diff)
downloadsamba-43e5592e9af95f2f2522cf8b015a76b14475729d.tar.gz
samba-43e5592e9af95f2f2522cf8b015a76b14475729d.tar.bz2
samba-43e5592e9af95f2f2522cf8b015a76b14475729d.zip
subunitrun: give more useful help
give some examples and more useful description for subunitrun command Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
-rwxr-xr-xsource4/scripting/bin/subunitrun27
1 files changed, 25 insertions, 2 deletions
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index bc7b42c610..9c87d2eca3 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -31,9 +31,31 @@ import samba.getopt as options
import samba.tests
-parser = optparse.OptionParser("subunitrun [options] <tests>")
+usage = 'subunitrun [options] <tests>'
+description = '''
+This runs a Samba python test suite. The tests are typically located in
+source4/scripting/python/samba/tests/*.py
+
+To run the tests from one of those modules, specify the test as
+samba.tests.MODULE. For example, to run the tests in common.py:
+
+ subunitrun samba.tests.common
+
+To list the tests in that module, use:
+
+ subunitrun -l samba.tests.common
+'''
+
+def format_description(formatter):
+ '''hack to prevent textwrap of the description'''
+ return description
+
+parser = optparse.OptionParser(usage=usage, description=description)
+parser.format_description = format_description
credopts = options.CredentialsOptions(parser)
+sambaopts = options.SambaOptions(parser)
parser.add_option_group(credopts)
+parser.add_option_group(sambaopts)
try:
from subunit.run import TestProgram
except ImportError:
@@ -45,7 +67,8 @@ else:
opts, args = parser.parse_args()
-samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.env_loadparm())
+lp = sambaopts.get_loadparm()
+samba.tests.cmdline_credentials = credopts.get_credentials(lp)
if getattr(opts, "listtests", False):
args.insert(0, "--list")