瀏覽代碼

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

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

+ 1 - 1
supervisor/options.py

@@ -267,7 +267,7 @@ class Options:
             self.options, self.args = getopt.getopt(
                 args, "".join(self.short_options), self.long_options)
         except getopt.error as 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

@@ -1037,8 +1037,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()