Explorar o código

Show errors from getopt using str() instead of repr()

Mike Naberezny %!s(int64=9) %!d(string=hai) anos
pai
achega
35cd07d15f
Modificáronse 2 ficheiros con 2 adicións e 3 borrados
  1. 1 1
      supervisor/options.py
  2. 1 2
      supervisor/tests/test_options.py

+ 1 - 1
supervisor/options.py

@@ -256,7 +256,7 @@ class Options:
             self.options, self.args = getopt.getopt(
                 args, "".join(self.short_options), self.long_options)
         except getopt.error, exc:
-            self.usage(repr(exc))
+            self.usage(str(exc))
 
         # Check for positional args
         if self.args and not self.positional_args_allowed:

+ 1 - 2
supervisor/tests/test_options.py

@@ -1023,8 +1023,7 @@ class ServerOptionsTests(unittest.TestCase):
         instance.configfile=StringIO('[supervisord]')
         instance.realize(args=["--bad=1"])
         self.assertEqual(len(recorder), 1)
-        self.assertEqual(recorder[0],
-            "GetoptError('option --bad not recognized', 'bad')")
+        self.assertEqual(recorder[0], "option --bad not recognized")
 
     def test_options_afunix(self):
         instance = self._makeOne()