summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-11-02 08:37:08 -0800
committerJelmer Vernooij <jelmer@samba.org>2014-11-22 02:23:10 +0100
commit330597507c796db55a48b084c7542f03ee4a93ee (patch)
treee9512308c51f412cae2716e5ea356efd3193eaa4
parentd6545fe27b35e63781f9f87fe9262bb933ffa9be (diff)
downloadsamba-330597507c796db55a48b084c7542f03ee4a93ee.tar.gz
samba-330597507c796db55a48b084c7542f03ee4a93ee.tar.xz
samba-330597507c796db55a48b084c7542f03ee4a93ee.zip
sites: Use samba.tests.subunitrun.
Change-Id: Ic06e1a0f7174683b6b817a5412b8635145329c00 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-xsource4/dsdb/tests/python/sites.py17
-rwxr-xr-xsource4/selftest/tests.py4
2 files changed, 8 insertions, 13 deletions
diff --git a/source4/dsdb/tests/python/sites.py b/source4/dsdb/tests/python/sites.py
index 8b984b2fe8..402d676ae1 100755
--- a/source4/dsdb/tests/python/sites.py
+++ b/source4/dsdb/tests/python/sites.py
@@ -22,8 +22,8 @@ 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
import samba.getopt as options
from samba import sites
@@ -31,8 +31,6 @@ from samba.auth import system_session
from samba.samdb import SamDB
import samba.tests
from samba.dcerpc import security
-from subunit.run import SubunitTestRunner
-import unittest
parser = optparse.OptionParser("dirsync.py [options] <host>")
sambaopts = options.SambaOptions(parser)
@@ -42,6 +40,9 @@ 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:
@@ -116,10 +117,4 @@ class SimpleSitesTests(SitesBaseTests):
ldb = SamDB(ldapshost, credentials=creds, session_info=system_session(lp), lp=lp)
-runner = SubunitTestRunner()
-rc = 0
-
-if not runner.run(unittest.makeSuite(SimpleSitesTests)).wasSuccessful():
- rc = 1
-
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index a69b5e37c5..33603d858e 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -469,9 +469,9 @@ planoldpythontestsuite("dc", "dsdb_schema_info",
extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')],
name="samba4.schemaInfo.python(dc)",
extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
-plantestsuite("samba4.urgent_replication.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'])
+plantestsuite_loadlist("samba4.urgent_replication.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb', '$LOADLIST', '$LISTOPT'])
plantestsuite_loadlist("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
-plantestsuite("samba4.ldap.sites.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
+plantestsuite_loadlist("samba4.ldap.sites.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
plantestsuite_loadlist("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
plantestsuite("samba4.ldap.possibleInferiors.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/samdb/ldb_modules/tests/possibleinferiors.py"), "ldap://$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN"])