In pyvmomi 6.0.0.2016.4, as a side effect of vmware/pyvmomi#341, connection failures now raise a socket.error instead of a requests.exceptions.ConnectionError, causing a test failure:
======================================================================
ERROR: test_serial_fixup_connection_error (COT.tests.test_deploy_esxi.TestCOTDeployESXi)
Call fixup_serial_ports() to connect to an invalid host.
----------------------------------------------------------------------
Traceback (most recent call last):
File "COT/tests/test_deploy_esxi.py", line 207, in test_serial_fixup_connection_error
self.instance.fixup_serial_ports(2)
File "COT/deploy_esxi.py", line 355, in fixup_serial_ports
self.username, self.password) as conn:
File "COT/deploy_esxi.py", line 70, in __enter__
return super(SmarterConnection, self).__enter__()
File ".tox/py27/lib/python2.7/site-packages/pyVim/connect.py", line 525, in __enter__
self.si = SmartConnect(*self.args, **self.kwargs)
File ".tox/py27/lib/python2.7/site-packages/pyVim/connect.py", line 786, in SmartConnect
sslContext)
File ".tox/py27/lib/python2.7/site-packages/pyVim/connect.py", line 671, in __FindSupportedVersion
sslContext)
File ".tox/py27/lib/python2.7/site-packages/pyVim/connect.py", line 591, in __GetServiceVersionDescription
path + "/vimServiceVersions.xml", sslContext)
File ".tox/py27/lib/python2.7/site-packages/pyVim/connect.py", line 557, in __GetElementTree
conn.request("GET", path)
File "/lib/python2.7/httplib.py", line 1057, in request
self._send_request(method, url, body, headers)
File "/lib/python2.7/httplib.py", line 1097, in _send_request
self.endheaders(body)
File "/lib/python2.7/httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "/lib/python2.7/httplib.py", line 897, in _send_output
self.send(msg)
File "/lib/python2.7/httplib.py", line 859, in send
self.connect()
File "/lib/python2.7/httplib.py", line 1270, in connect
HTTPConnection.connect(self)
File "/lib/python2.7/httplib.py", line 836, in connect
self.timeout, self.source_address)
File "/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 61] Connection refused
In pyvmomi 6.0.0.2016.4, as a side effect of vmware/pyvmomi#341, connection failures now raise a
socket.error
instead of arequests.exceptions.ConnectionError
, causing a test failure: