From d6545fe27b35e63781f9f87fe9262bb933ffa9be Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Nov 2014 08:32:24 -0800 Subject: speedtest: Use samba.tests.subunitrun. Change-Id: Id842c3f74aec24faeab68e975ff4d9e9a0dc337b Signed-off-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett --- source4/scripting/devel/speedtest.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/source4/scripting/devel/speedtest.py b/source4/scripting/devel/speedtest.py index 84d3760c05..581966b617 100755 --- a/source4/scripting/devel/speedtest.py +++ b/source4/scripting/devel/speedtest.py @@ -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] ") 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) -- cgit