[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Nov 13 02:51:02 MST 2012

The branch, master has been updated
       via  095c762 selftest: Add --tmpdir to 'samba-tool gpo create' test
      from  c5f53ed Revert "selftest/skip: add samba.tests.samba_tool.gpo until it's stable"


- Log -----------------------------------------------------------------
commit 095c7627dfbc1e25665d342699ea004dc8d0880b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 13 13:31:53 2012 +1100

    selftest: Add --tmpdir to 'samba-tool gpo create' test
    This was the cause of the flakey test, and was only noticed when
    multiple different users ran autobuild at the same time on the same
    We use shutil.rmtree to wipe the directory before the tests finishes
    as required by the TestCaseInTempDir class.
    Andrew Bartlett
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Tue Nov 13 10:50:56 CET 2012 on sn-devel-104


Summary of changes:
 .../python/samba/tests/samba_tool/base.py          |    2 +-
 .../scripting/python/samba/tests/samba_tool/gpo.py |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/tests/samba_tool/base.py b/source4/scripting/python/samba/tests/samba_tool/base.py
index 26ce459..60ccaa5 100644
--- a/source4/scripting/python/samba/tests/samba_tool/base.py
+++ b/source4/scripting/python/samba/tests/samba_tool/base.py
@@ -29,7 +29,7 @@ from cStringIO import StringIO
 from samba.netcmd.main import cmd_sambatool
 import samba.tests
-class SambaToolCmdTest(samba.tests.TestCase):
+class SambaToolCmdTest(samba.tests.TestCaseInTempDir):
     def getSamDB(self, *argv):
         """a convenience function to get a samdb instance so that we can query it"""
diff --git a/source4/scripting/python/samba/tests/samba_tool/gpo.py b/source4/scripting/python/samba/tests/samba_tool/gpo.py
index c2e069d..7ada91f 100644
--- a/source4/scripting/python/samba/tests/samba_tool/gpo.py
+++ b/source4/scripting/python/samba/tests/samba_tool/gpo.py
@@ -20,6 +20,7 @@
 import os
 from samba.tests.samba_tool.base import SambaToolCmdTest
+import shutil
 class GpoCmdTestCase(SambaToolCmdTest):
     """Tests for samba-tool time subcommands"""
@@ -39,13 +40,18 @@ os.environ["SERVER"])
     def test_fetch(self):
         """Run against a real GPO, and make sure it passes"""
-        (result, out, err) = self.runsubcmd("gpo", "fetch", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"], "--tmpdir", os.environ['SELFTEST_PREFIX'])
+        (result, out, err) = self.runsubcmd("gpo", "fetch", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"], "--tmpdir", self.tempdir)
         self.assertCmdSuccess(result, "Ensuring gpo fetched successfully")
+        shutil.rmtree(os.path.join(self.tempdir, "policy"))
     def setUp(self):
         """set up a temporary GPO to work with"""
         super(GpoCmdTestCase, self).setUp()
-        (result, out, err) = self.runsubcmd("gpo", "create", self.gpo_name, "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
+        (result, out, err) = self.runsubcmd("gpo", "create", self.gpo_name,
+                                            "-H", "ldap://%s" % os.environ["SERVER"],
+                                            "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]),
+                                            "--tmpdir", self.tempdir)
+        shutil.rmtree(os.path.join(self.tempdir, "policy"))
         self.assertCmdSuccess(result, "Ensuring gpo created successfully")
             self.gpo_guid = "{%s}" % out.split("{")[1].split("}")[0]

Samba Shared Repository

More information about the samba-cvs mailing list