mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-13 08:51:38 +08:00
Fix the following exception:
```
test/integration/test_cli_runners.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/galaxy_test/driver/integration_util.py:73: in setUpClass
cls._test_driver.setup(config_object=cls)
lib/galaxy_test/driver/driver_util.py:942: in setup
self._register_and_run_servers(config_object)
lib/galaxy_test/driver/driver_util.py:1008: in _register_and_run_servers
config_object=config_object,
lib/galaxy_test/driver/driver_util.py:827: in launch_server
host=host, port=port
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
webapp = <paste.urlmap.URLMap object at 0x7f011b68c110>, port = '8845'
host = '127.0.0.1'
def serve_webapp(webapp, port=None, host=None):
"""Serve the webapp on a recommend port or a free one.
Return the port the webapp is running on.
"""
server = None
for port in attempt_ports(port):
try:
server = httpserver.serve(webapp, host=host, port=port, start_loop=False)
break
except socket.error as e:
> if e[0] == 98:
E TypeError: 'OSError' object is not subscriptable
```
Also use `e.errno` instead of `e.args[0]` to get the errno of
`socket.error`, since the latter may return an error string depending on
how the exception was raised.
Also:
- move standard library imports to the top
- fix issues reported by flake8-bugbear