speedtest: Use samba.tests.subunitrun.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2014 16:32:24 +0000 (08:32 -0800)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 22 Nov 2014 01:23:10 +0000 (02:23 +0100)
Change-Id: Id842c3f74aec24faeab68e975ff4d9e9a0dc337b
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/scripting/devel/speedtest.py

index 84d3760c0506eb93971eb1c805227bfc64e5d6a8..581966b61747135b36bb76acf8f88e48e397dd51 100755 (executable)
@@ -30,8 +30,7 @@ from decimal import Decimal
 
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
+from samba.tests.subunitrun import TestProgram, SubunitOptions
 
 import samba.getopt as options
 
@@ -45,18 +44,17 @@ from samba.samdb import SamDB
 from samba.credentials import Credentials
 import samba.tests
 from samba.tests import delete_force
-from subunit.run import SubunitTestRunner
-import unittest
 
 parser = optparse.OptionParser("speedtest.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 
-
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -230,12 +228,4 @@ if not "://" in host:
 ldb_options = ["modules:paged_searches"]
 ldb = SamDB(host, credentials=creds, session_info=system_session(), lp=lp, options=ldb_options)
 
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(SpeedTestAddDel))
-suite.addTests(unittest.makeSuite(AclSearchSpeedTest))
-if not runner.run(suite).wasSuccessful():
-    rc = 1
-else:
-    rc = 0
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)