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:
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")