瀏覽代碼

Fix syntax for Python 2.4

Mike Naberezny 9 年之前
父節點
當前提交
4aae5b2c35
共有 1 個文件被更改,包括 10 次插入7 次删除
  1. 10 7
      supervisor/tests/test_options.py

+ 10 - 7
supervisor/tests/test_options.py

@@ -929,8 +929,9 @@ class ServerOptionsTests(unittest.TestCase):
         notfound = os.path.join(os.path.dirname(__file__), 'notfound')
         socketname = tempfile.mktemp()
         try:
-            with open(socketname, 'w') as f:
-                f.write('foo')
+            f = open(socketname, 'w')
+            f.write('foo')
+            f.close()
             instance = self._makeOne()
             class Server:
                 pass
@@ -950,8 +951,9 @@ class ServerOptionsTests(unittest.TestCase):
     def test_cleanup_removes_pidfile(self):
         pidfile = tempfile.mktemp()
         try:
-            with open(pidfile, 'w') as f:
-                f.write('2')
+            f = open(pidfile, 'w')
+            f.write('2')
+            f.close()
             instance = self._makeOne()
             instance.pidfile = pidfile
             instance.cleanup()
@@ -1669,7 +1671,7 @@ class ServerOptionsTests(unittest.TestCase):
         try:
             instance.process_groups_from_parser(config)
             self.fail('nothing raised')
-        except ValueError as exc:
+        except ValueError, exc:
             self.assertEqual(exc.args[0],
                 'supervisor.tests.base:nonexistant cannot be '
                 'resolved within [eventlistener:cat]')
@@ -2153,8 +2155,9 @@ class ServerOptionsTests(unittest.TestCase):
         instance.childlogdir = dirname
         ident = instance.identifier
         filename = os.path.join(dirname, 'cat-stdout---%s-ayWAp9.log' % ident)
-        with open(filename, 'w') as f:
-            f.write("log")
+        f = open(filename, 'w')
+        f.write("log")
+        f.close()
         def raise_oserror(*args):
             raise OSError(errno.ENOENT)
         instance.remove = raise_oserror