run-tests: move umask into TestRunner.run()
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Apr 2014 10:06:19 -0700
changeset 21375 bd70dcb91af6
parent 21374 592b3d2616d7
child 21376 e4366bc08879
run-tests: move umask into TestRunner.run() We now properly restore the umask as well, since run() tries to clean up after itself.
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 10:05:00 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 10:06:19 2014 -0700
@@ -1016,9 +1016,13 @@
 
     def run(self, args):
         """Run the test suite."""
-        self._checktools()
-        tests = self.findtests(args)
-        return self._run(tests)
+        oldmask = os.umask(022)
+        try:
+            self._checktools()
+            tests = self.findtests(args)
+            return self._run(tests)
+        finally:
+            os.umask(oldmask)
 
     def _run(self, tests):
         if self.options.random:
@@ -1459,7 +1463,6 @@
     parser = parser or getparser()
     (options, args) = parseargs(args, parser)
     runner.options = options
-    os.umask(022)
 
     return runner.run(args)