Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_version():
vcall = sp.Popen(
['snakeviz', '--version'], stdout=sp.PIPE, stderr=sp.PIPE)
out, err = vcall.communicate()
# in Python <= 3.3 this comes out on stderr, otherwise on stdout
assert version.version in out.decode('utf-8') or \
version.version in err.decode('utf-8')
def build_parser():
parser = SVArgumentParser(
description='Start SnakeViz to view a Python profile.')
parser.add_argument('filename', help='Python profile to view')
parser.add_argument('-v', '--version', action='version',
version=('%(prog)s ' + version.version))
parser.add_argument('-H', '--hostname', metavar='ADDR', default='127.0.0.1',
help='hostname to bind to (default: %(default)s)')
parser.add_argument('-p', '--port', type=int, metavar='PORT', default=8080,
help='port to bind to; if this port is already in use a '
'free port will be selected automatically '
'(default: %(default)s)')
parser.add_argument('-b', '--browser', metavar='BROWSER_PATH',
help='name of webbrowser to launch as described in '
'the documentation of Python\'s webbrowser module: '
'https://docs.python.org/3/library/webbrowser.html')
parser.add_argument('-s', '--server', action="store_true", default=False,
help='start SnakeViz in server-only mode--'