summaryrefslogtreecommitdiffstats
path: root/source4/dsdb/tests/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-11-01 20:51:46 -0700
committerJelmer Vernooij <jelmer@samba.org>2014-11-22 02:23:10 +0100
commit8d8d800a0f8ea3e822ee4d3693058b24307ba4e2 (patch)
tree0163009e32745dba1538e8fbb78da5379350843d /source4/dsdb/tests/python
parenta92877f955baf0ed8420f77898bd4405bd319c67 (diff)
downloadsamba-8d8d800a0f8ea3e822ee4d3693058b24307ba4e2.tar.gz
samba-8d8d800a0f8ea3e822ee4d3693058b24307ba4e2.tar.xz
samba-8d8d800a0f8ea3e822ee4d3693058b24307ba4e2.zip
Add convenience class for old-style Samba subunit python tests.
Change-Id: I84a97cc71cfa99c14e0c93ec19ff9eea6149bb5a Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/tests/python')
-rwxr-xr-xsource4/dsdb/tests/python/dirsync.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py
index 14810d3631..2de77366ec 100755
--- a/source4/dsdb/tests/python/dirsync.py
+++ b/source4/dsdb/tests/python/dirsync.py
@@ -22,8 +22,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
import samba.getopt as options
import base64
@@ -40,8 +39,6 @@ from samba.samdb import SamDB
from samba.credentials import Credentials, DONT_USE_KERBEROS
import samba.tests
from samba.tests import delete_force
-from subunit.run import SubunitTestRunner
-import unittest
parser = optparse.OptionParser("dirsync.py [options] <host>")
sambaopts = options.SambaOptions(parser)
@@ -57,7 +54,7 @@ if len(args) < 1:
parser.print_usage()
sys.exit(1)
-host = args[0]
+host = args.pop()
if not "://" in host:
ldaphost = "ldap://%s" % host
ldapshost = "ldaps://%s" % host
@@ -696,13 +693,13 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
self.assertEqual(str(res[0].dn), "")
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(SimpleDirsyncTests))
-suite.addTests(unittest.makeSuite(ExtendedDirsyncTests))
-if not runner.run(suite).wasSuccessful():
- rc = 1
+if getattr(opts, "listtests", False):
+ args.insert(0, "--list")
else:
- rc = 0
+ lp = sambaopts.get_loadparm()
+ samba.tests.cmdline_credentials = credopts.get_credentials(lp)
+if getattr(opts, 'load_list', None):
+ args.insert(0, "--load-list=%s" % opts.load_list)
-sys.exit(rc)
+
+TestProgram(module=__name__, argv=[sys.argv[0]] + args)