[Buildbot-commits] buildbot/buildbot/test test_slavecommand.py, 1.24, 1.25

Brian Warner warner at users.sourceforge.net
Tue Jul 3 17:59:05 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24963/buildbot/test

Modified Files:
	test_slavecommand.py 
Log Message:
[project @ rmdirRecursive: chmod files to 0700 before deleting them. Closes #29.]

Original author: warner at lothar.com
Date: 2007-07-03 17:51:51+00:00

Index: test_slavecommand.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_slavecommand.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- test_slavecommand.py	11 Dec 2006 08:23:29 -0000	1.24
+++ test_slavecommand.py	3 Jul 2007 17:59:03 -0000	1.25
@@ -14,6 +14,42 @@
 # test slavecommand.py by running the various commands with a fake
 # SlaveBuilder object that logs the calls to sendUpdate()
 
+class Utilities(unittest.TestCase):
+    def mkdir(self, basedir, path, mode=None):
+        fn = os.path.join(basedir, path)
+        os.makedirs(fn)
+        if mode is not None:
+            os.chmod(fn, mode)
+
+    def touch(self, basedir, path, mode=None):
+        fn = os.path.join(basedir, path)
+        f = open(fn, "w")
+        f.write("touch\n")
+        f.close()
+        if mode is not None:
+            os.chmod(fn, mode)
+
+    def test_rmdirRecursive(self):
+        basedir = "slavecommand/Utilities/test_rmdirRecursive"
+        os.makedirs(basedir)
+        d = os.path.join(basedir, "doomed")
+        self.mkdir(d, "a/b")
+        self.touch(d, "a/b/1.txt")
+        self.touch(d, "a/b/2.txt", 0444)
+        self.touch(d, "a/b/3.txt", 0)
+        self.mkdir(d, "a/c")
+        self.touch(d, "a/c/1.txt")
+        self.touch(d, "a/c/2.txt", 0444)
+        self.touch(d, "a/c/3.txt", 0)
+        os.chmod(os.path.join(d, "a/c"), 0444)
+        self.mkdir(d, "a/d")
+        self.touch(d, "a/d/1.txt")
+        self.touch(d, "a/d/2.txt", 0444)
+        self.touch(d, "a/d/3.txt", 0)
+        os.chmod(os.path.join(d, "a/d"), 0)
+
+        commands.rmdirRecursive(d)
+        self.failIf(os.path.exists(d))
 
 
 class ShellBase(SignalMixin):





More information about the Commits mailing list