[Buildbot-commits] buildbot/buildbot/test test_runner.py,1.4,1.5

Brian Warner warner at users.sourceforge.net
Tue Apr 26 20:10:12 UTC 2005


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

Modified Files:
	test_runner.py 
Log Message:
* buildbot/scripts/runner.py (loadOptions): do something sane for
windows, I think. We use %APPDATA%/buildbot instead of
~/.buildbot, but we still search everywhere from the current
directory up to the root for a .buildbot/ subdir. The "is it under
$HOME" security test was replaced with "is it owned by the current
user", which is only performed under posix.

* buildbot/test/test_runner.py (Options.testFindOptions): update
tests to match. The "is it owned by the current user" check is
untested. The test has been re-enabled for windows.


Index: test_runner.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_runner.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_runner.py	26 Apr 2005 18:40:07 -0000	1.4
+++ test_runner.py	26 Apr 2005 20:10:07 -0000	1.5
@@ -10,11 +10,6 @@
 class Options(unittest.TestCase):
     optionsFile = "SDFsfsFSdfsfsFSD"
 
-    def setUp(self):
-        self.savedHome = os.environ['HOME']
-    def tearDown(self):
-        os.environ['HOME'] = self.savedHome
-
     def make(self, d, key):
         # we use a wacky filename here in case the test code discovers the
         # user's real ~/.buildbot/ directory
@@ -23,9 +18,10 @@
         f.write("key = '%s'\n" % key)
         f.close()
 
-    def check(self, d, key=None):
+    def check(self, d, key):
         basedir = os.sep.join(d)
-        options = runner.loadOptions(basedir, self.optionsFile)
+        options = runner.loadOptions(self.optionsFile, here=basedir,
+                                     home=self.home)
         if key is None:
             self.failIf(options.has_key('key'))
         else:
@@ -35,20 +31,12 @@
         self.make(["home", "dir1", "dir2", "dir3"], "one")
         self.make(["home", "dir1", "dir2"], "two")
         self.make(["home"], "home")
-        self.make(["nothome", "dir1", "dir2"], "three")
-        self.make(["nothome"], "nothome")
-        os.environ['HOME'] = os.path.abspath("home")
+        self.home = os.path.abspath("home")
 
         self.check(["home", "dir1", "dir2", "dir3"], "one")
         self.check(["home", "dir1", "dir2"], "two")
         self.check(["home", "dir1"], "home")
-        self.check(["nothome", "dir1", "dir2"], "home")
-        self.check(["nothome", "dir1"], "home")
-        self.check(["nothome"], "home")
-        self.check(["home", "dir1"], "home")
-        os.environ['HOME'] = os.path.abspath("reallynothome")
-        self.check(["home", "dir1"], None)
 
-if runtime.platformType != 'posix':
-    # I need to figure out what "home directory" might mean on windows
-    del Options
+        self.home = os.path.abspath("nothome")
+        os.makedirs(os.sep.join(["nothome", "dir1"]))
+        self.check(["nothome", "dir1"], None)





More information about the Commits mailing list