[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Thu Nov 10 17:11:03 MST 2011


The branch, master has been updated
       via  c2eb036 policy/tests: Fix import of TestCase.
       via  b24dd2c selftesthelper: Fix argument order.
       via  a0a31d3 selftest: Make planoldpythontestsuite arguments consistent with planpythontestsuite.
       via  e0b8af5 selftesthelpers: Fix syntax error.
       via  0fcec8b selftest: Simplify calling of python tests.
       via  8ea8683 selftest: Allow passing arbitrary number of additional python path values.
       via  a0ed2da ldb: Re-apply pyldb fixes from Tridge and Amity, using unittest rather than samba.tests.
       via  ad40581 subunitrun: Add notes about subunitrun being deprecated.
       via  d84ba4f selftest: re-implement directory option for planpythontestsuite.
       via  f5d3e45 Revert "test: added directory option to planpythontestsuite()"
       via  ae88d73 Revert "test: added -D option to subunitrun"
       via  04be49f Revert "pyldb: fixed ldb API test"
      from  4cafcf0 libcli/cldap/cldap.c - remove outdated comment

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c2eb036d3f25d7d4456400595aec8f8c8a0b1cb2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 23:33:47 2011 +0100

    policy/tests: Fix import of TestCase.
    
    Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date: Fri Nov 11 01:10:49 CET 2011 on sn-devel-104

commit b24dd2ca1c5fe66df27b76bc9b5e818623eeb03b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 23:33:31 2011 +0100

    selftesthelper: Fix argument order.

commit a0a31d32126162b7ec6606fa03cb5029e434f58d
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 21:50:38 2011 +0100

    selftest: Make planoldpythontestsuite arguments consistent with planpythontestsuite.

commit e0b8af57c43e3fcb0ed9485ac707761a04582a34
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 20:44:59 2011 +0100

    selftesthelpers: Fix syntax error.

commit 0fcec8bfa0da647d478198a2b468951f230a9022
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 20:39:34 2011 +0100

    selftest: Simplify calling of python tests.

commit 8ea8683f72fbd460507b987ca27a859a8a8da3c0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 20:24:17 2011 +0100

    selftest: Allow passing arbitrary number of additional python path values.

commit a0ed2da1053a15f2b453556952390968d86fa2f2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 20:20:00 2011 +0100

    ldb: Re-apply pyldb fixes from Tridge and Amity, using unittest rather
    than samba.tests.

commit ad40581142ca1e26406b0048b78d43ce54a5a2ff
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 14:03:29 2011 +0100

    subunitrun: Add notes about subunitrun being deprecated.

commit d84ba4fc0a28b481229c57754deb3dcacf61ed93
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 13:59:21 2011 +0100

    selftest: re-implement directory option for planpythontestsuite.

commit f5d3e4572234ab28a95a35c87e7b56cf94ab1780
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 13:46:01 2011 +0100

    Revert "test: added directory option to planpythontestsuite()"
    
    This reverts commit b0be72d5080aed3da3f33a45b72f88e90fbe3d13.
    
    I'll add an alternative that uses subunit.run.

commit ae88d7390bc743d1a424c3115762556d6c9173ef
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 13:43:43 2011 +0100

    Revert "test: added -D option to subunitrun"
    
    This reverts commit ac0bba2ea18e2e9ac578a333a3b260951e4c976e.
    
    "python -m subunit.run" is the preferred way of running tests to
    generate subunit. I also don't want to move too far away from
    the standard test running infrastructure for python so that
    other test runners (nosetests, trial, tribunal, ...) can be used with
    Samba code.

commit 04be49f60091b54f6ab7cf2920b590b3f758ca81
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Nov 10 13:40:03 2011 +0100

    Revert "pyldb: fixed ldb API test"
    
    This reverts commit 333248f08c83cc5b18f8e7e84cb19d79a8309d6e.
    
    This commit made the pyldb tests depend on the Samba testsuite.

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/tests/python/api.py                 |   11 ++++-
 selftest/selftesthelpers.py                 |   23 ++++-------
 source4/lib/policy/tests/python/bindings.py |    5 +-
 source4/scripting/bin/subunitrun            |   17 ++++++--
 source4/selftest/tests.py                   |   55 +++++++++++++++++++-------
 5 files changed, 73 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index 4a582be..97dd020 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -2,8 +2,8 @@
 # Simple tests for the ldb python bindings.
 # Copyright (C) 2007 Jelmer Vernooij <jelmer at samba.org>
 
-import os, sys
-from samba.tests import TestCase, TestSkipped
+import os
+from unittest import TestCase
 
 import ldb
 
@@ -16,6 +16,7 @@ def filename():
         dir_prefix = None
     return tempfile.mktemp(dir=dir_prefix)
 
+
 class NoContextTests(TestCase):
 
     def test_valid_attr_name(self):
@@ -755,7 +756,13 @@ class LdbResultTests(TestCase):
                 found = True
         self.assertTrue(found)
 
+
 class VersionTests(TestCase):
 
     def test_version(self):
         self.assertTrue(isinstance(ldb.__version__, str))
+
+
+if __name__ == '__main__':
+    import unittest
+    unittest.TestProgram()
diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py
index 58a2f0f..a7924d6 100644
--- a/selftest/selftesthelpers.py
+++ b/selftest/selftesthelpers.py
@@ -158,17 +158,12 @@ def planperltestsuite(name, path):
         skiptestsuite(name, "Test::More not available")
 
 
-def planpythontestsuite(env, module, name=None, directory=None):
-
-    if name is None:
-        name = module
-    if has_system_subunit_run:
-        cmd = [python, "-m", "subunit.run", "$LISTOPT", module]
-        if directory is not None:
-            cmd.extend(['-D', directory])
-        plantestsuite_idlist(name, env, cmd)
-    else:
-        cmd = "PYTHONPATH=$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools %s -m subunit.run $LISTOPT %s" % (srcdir(), srcdir(), python, module)
-        if directory is not None:
-            cmd += ' -D %s' % directory
-        plantestsuite_idlist(name, env, cmd)
+def planpythontestsuite(env, module, name=None, extra_path=[]):
+    pypath = list(extra_path)
+    if not has_system_subunit_run:
+        pypath.extend(["%s/lib/subunit/python" % srcdir(),
+            "%s/lib/testtools" % srcdir()])
+    args = [python, "-m", "subunit.run", "$LISTOPT", module]
+    if pypath:
+        args.insert(0, "PYTHONPATH=%s" % ":".join(["$PYTHONPATH"] + pypath))
+    plantestsuite_idlist(name, env, args)
diff --git a/source4/lib/policy/tests/python/bindings.py b/source4/lib/policy/tests/python/bindings.py
index afe8519..08b67e7 100644
--- a/source4/lib/policy/tests/python/bindings.py
+++ b/source4/lib/policy/tests/python/bindings.py
@@ -21,10 +21,11 @@
 
 """
 
-import samba
+from samba.tests import TestCase
 from samba import policy
 
-class PolicyTests(samba.tests.TestCase):
+
+class PolicyTests(TestCase):
 
     def test_get_gpo_flags(self):
         self.assertEquals(["GPO_FLAG_USER_DISABLE"],
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index 9b3c315..dd4290d 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -1,6 +1,15 @@
 #!/usr/bin/env python
 
 # Simple subunit testrunner for python
+
+# NOTE: This is deprecated - Using the standard subunit runner is
+# preferred - e.g. "python -m subunit.run YOURMODULE".
+#
+# This wrapper will be removed once all tests can be run
+# without it. At the moment there are various tests which still
+# get e.g. credentials passed via command-line options to this
+# script.
+
 # Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
 #   
 # This program is free software; you can redistribute it and/or modify
@@ -44,6 +53,9 @@ samba.tests.MODULE. For example, to run the tests in common.py:
 To list the tests in that module, use:
 
    subunitrun -l samba.tests.common
+
+NOTE: This script is deprecated in favor of "python -m subunit.run". Don't use
+it unless it can be avoided.
 '''
 
 def format_description(formatter):
@@ -56,8 +68,6 @@ credopts = options.CredentialsOptions(parser)
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(credopts)
 parser.add_option_group(sambaopts)
-parser.add_option('-D', '--directory', dest='directory', default=None,
-                  help='set test directory')
 try:
     from subunit.run import TestProgram
 except ImportError:
@@ -74,8 +84,5 @@ samba.tests.cmdline_credentials = credopts.get_credentials(lp)
 if getattr(opts, "listtests", False):
     args.insert(0, "--list")
 
-if opts.directory:
-    sys.path.append(opts.directory)
-
 runner = SubunitTestRunner()
 program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner)
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index c36b6e5..4e6ce3d 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -387,19 +387,23 @@ else:
     skiptestsuite("samba4.nss.test using winbind(s4member)", "nsstest not available")
 
 subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
-def plansambapythontestsuite(name, env, path, module, environ={}, extra_args=[]):
+def planoldpythontestsuite(env, module, name=None, extra_path=[], environ={}, extra_args=[]):
     environ = dict(environ)
-    environ["PYTHONPATH"] = "$PYTHONPATH:" + path
+    py_path = list(extra_path)
+    if py_path:
+        environ["PYTHONPATH"] = ":".join(["$PYTHONPATH"] + py_path)
     args = ["%s=%s" % item for item in environ.iteritems()]
     args += [subunitrun, "$LISTOPT", module]
     args += extra_args
+    if name is None:
+        name = module
     plantestsuite(name, env, args)
 
-plantestsuite_idlist("ldb.python", "none", [subunitrun, '-D', 'lib/ldb/tests/python', "api"])
+planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python'])
 planpythontestsuite("none", "samba.tests.credentials")
-plantestsuite_idlist("samba.tests.gensec", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.gensec"])
+planoldpythontestsuite("dc:local", "samba.tests.gensec", extra_args=['-U"$USERNAME%$PASSWORD"'])
 planpythontestsuite("none", "samba.tests.registry")
-plansambapythontestsuite("tdb.python", "none", "%s/lib/tdb/python/tests" % srcdir(), 'simple')
+planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python")
 planpythontestsuite("none", "samba.tests.auth")
 planpythontestsuite("none", "samba.tests.getopt")
 planpythontestsuite("none", "samba.tests.security")
@@ -426,12 +430,15 @@ planpythontestsuite("dc:local", "samba.tests.samba_tool.user")
 
 planpythontestsuite("none", "subunit")
 planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho")
-plantestsuite_idlist("samba.tests.dcerpc.registry", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.dcerpc.registry"])
-plantestsuite_idlist("samba.tests.dcerpc.dnsserver(dc)", "dc", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.dcerpc.dnsserver"])
+planoldpythontestsuite("dc:local", "samba.tests.dcerpc.registry", extra_args=['-U"$USERNAME%$PASSWORD"'])
+planoldpythontestsuite("dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"'])
 plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
 plantestsuite("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
 plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
-plansambapythontestsuite("samba4.schemaInfo.python(dc)", "dc", os.path.join(samba4srcdir, 'dsdb/tests/python'), 'dsdb_schema_info', extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
+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", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'], allow_empty_output=True)
 plantestsuite("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
 plantestsuite("samba4.ldap.sites.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
@@ -441,7 +448,7 @@ for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
     plantestsuite("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
     plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
     if env != "fl2000dc":
-        # This test makes excessively use of the "userPassword" attribute which
+        # This test makes excessive use of the "userPassword" attribute which
         # isn't available on DCs with Windows 2000 domain function level -
         # therefore skip it in that configuration
         plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"])
@@ -452,7 +459,7 @@ planpythontestsuite("none", "samba.tests.ntacls")
 plantestsuite("samba4.deletetest.python(dc)", "dc", ['PYTHONPATH="$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools"' % (srcdir(), srcdir()),
                                                      python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"),
                                                      '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
-plansambapythontestsuite("samba4.policy.python", "none", "%s/lib/policy/tests/python" % samba4srcdir, 'bindings')
+planpythontestsuite("none", "bindings", extra_path=["%s/lib/policy/tests/python" % samba4srcdir], name="samba4.policy.python")
 plantestsuite("samba4.blackbox.samba3dump", "none", [python, os.path.join(samba4srcdir, "scripting/bin/samba3dump"), os.path.join(samba4srcdir, "../testdata/samba3")], allow_empty_output=True)
 plantestsuite("samba4.blackbox.upgrade", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_s3upgrade.sh"), '$PREFIX/provision'])
 plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision'])
@@ -464,11 +471,29 @@ plantestsuite("samba4.blackbox.spn.py(dc:local)", "dc:local", ["PYTHON=%s" % pyt
 plantestsuite("samba4.ldap.bind(dc)", "dc", [python, os.path.join(srcdir(), "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"'])
 
 # DRS python tests
-plansambapythontestsuite("samba4.blackbox.samba-tool.drs(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'scripting/python'), "samba.tests.blackbox.samba_tool_drs", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
-plansambapythontestsuite("samba4.drs.replica_sync.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "replica_sync", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
-plansambapythontestsuite("samba4.drs.delete_object.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "delete_object", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
-plansambapythontestsuite("samba4.drs.fsmo.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "fsmo", environ={'DC1': "$DC_SERVER", 'DC2': "$VAMPIRE_DC_SERVER"}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
-plansambapythontestsuite("samba4.drs.repl_schema.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "repl_schema", environ={'DC1': "$DC_SERVER", 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
+planoldpythontestsuite("vampire_dc", "samba.tests.blackbox.samba_tool_drs",
+        environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
+        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
+planoldpythontestsuite("vampire_dc", "replica_sync",
+        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
+        name="samba4.drs.replica_sync.python(vampire_dc)",
+        environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
+        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
+planoldpythontestsuite("vampire_dc", "delete_object",
+        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
+        name="samba4.drs.delete_object.python(vampire_dc)",
+        environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
+        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
+planoldpythontestsuite("vampire_dc", "fsmo",
+        name="samba4.drs.fsmo.python(vampire_dc)",
+        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
+        environ={'DC1': "$DC_SERVER", 'DC2': "$VAMPIRE_DC_SERVER"},
+        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
+planoldpythontestsuite("vampire_dc", "repl_schema",
+        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
+        name="samba4.drs.repl_schema.python(vampire_dc)",
+        environ={'DC1': "$DC_SERVER", 'DC2': '$VAMPIRE_DC_SERVER'},
+        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
 
 # This makes sure we test the rid allocation code
 t = "rpc.samr.large-dc"


-- 
Samba Shared Repository


More information about the samba-cvs mailing list