Use samba.tests.subunitrun in urgent replication test.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2014 04:22:59 +0000 (21:22 -0700)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 24 Nov 2014 09:46:05 +0000 (10:46 +0100)
Change-Id: I3e7a32876d557ac376326ab75e851298e874d584
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/urgent_replication.py

index 8083ce42a1859b08593b39d9cfe5b3bbd052ab04..19176c18c80e456770c70dc01abbd48b38b60ee8 100755 (executable)
@@ -5,8 +5,7 @@ import optparse
 import sys
 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
 
 from ldb import (LdbError, ERR_NO_SUCH_OBJECT, Message,
     MessageElement, Dn, FLAG_MOD_REPLACE)
@@ -14,10 +13,6 @@ import samba.tests
 import samba.dsdb as dsdb
 import samba.getopt as options
 
-from subunit.run import SubunitTestRunner
-
-import unittest
-
 parser = optparse.OptionParser("urgent_replication.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
@@ -26,6 +21,8 @@ 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:
@@ -342,10 +339,4 @@ rIDAvailablePool: 133001-1073741823""", ["relax:0"])
         self.assertNotEquals(res["uSNHighest"], res["uSNUrgent"])
 
 
-runner = SubunitTestRunner()
-rc = 0
-#
-if not runner.run(unittest.makeSuite(UrgentReplicationTests)).wasSuccessful():
-    rc = 1
-
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)