test: added -D option to subunitrun
authorAndrew Tridgell <tridge@samba.org>
Wed, 9 Nov 2011 02:10:00 +0000 (13:10 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 10 Nov 2011 03:24:21 +0000 (14:24 +1100)
this allows for:

 subunitrun -D lib/ldb/tests/python api

which makes this easier for developers

source4/scripting/bin/subunitrun

index 9c87d2eca3de23bb9e1d1adbe41ec44cad7adbe5..9b3c315d2cf266f4d0a12aaeb7e9af9121c9583e 100755 (executable)
@@ -56,6 +56,8 @@ credopts = options.CredentialsOptions(parser)
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(credopts)
 parser.add_option_group(sambaopts)
+parser.add_option('-D', '--directory', dest='directory', default=None,
+                  help='set test directory')
 try:
     from subunit.run import TestProgram
 except ImportError:
@@ -72,5 +74,8 @@ samba.tests.cmdline_credentials = credopts.get_credentials(lp)
 if getattr(opts, "listtests", False):
     args.insert(0, "--list")
 
+if opts.directory:
+    sys.path.append(opts.directory)
+
 runner = SubunitTestRunner()
 program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner)