浏览代码
test_options_unixsocket_configfile: Don't use argv
Without this, if you invoke a test command that has command-line
options, `supervisor.options` will try to parse those options and can
fail because of unrecognized options:
$ .tox/py27/bin/py.test -v supervisor/tests/test_options.py -k test_options_unixsocket_configfile
...
self = <supervisor.options.ClientOptions instance at 0x103aeb050>, msg = GetoptError('option -v not recognized', 'v')
def usage(self, msg):
"""Print a brief error message to stderr and exit(2)."""
self.stderr.write("Error: %s\n" % str(msg))
self.stderr.write("For help, use %s -h\n" % self.progname)
> self.exit(2)
E SystemExit: 2
supervisor/options.py:143: SystemExit
-----------------------------------------------------------------------------
Captured stderr call
-----------------------------------------------------------------------------
Error: option -v not recognized
...
Changed test_options_unixsocket_configfile to explictly set `arg` to an
empty tuple so that `*arg is not None` and it doesn't pull args from
`sys.argv`.
Output:
$ .tox/py27/bin/py.test -v supervisor/tests/test_options.py -k test_options_unixsocket_configfile
...
supervisor/tests/test_options.py::ClientOptionsTests::test_options_unixsocket_configfile PASSED
...