test: Avoid ConnectionResetErrors during RPC tests

This is necessary on FreeBSD and MacOSX, at least.

See https://github.com/bitcoin/bitcoin/pull/8834#issuecomment-250450213
This commit is contained in:
Wladimir J. van der Laan 2016-09-29 15:02:08 +00:00 committed by Jack Grigg
parent 2edad86b2d
commit e93a3e1945
No known key found for this signature in database
GPG Key ID: 6A6914DAFBEA00DA
1 changed files with 3 additions and 2 deletions

View File

@ -125,8 +125,9 @@ class AuthServiceProxy(object):
return self._get_response()
else:
raise
except BrokenPipeError:
# Python 3.5+ raises this instead of BadStatusLine when the connection was reset
except (BrokenPipeError,ConnectionResetError):
# Python 3.5+ raises BrokenPipeError instead of BadStatusLine when the connection was reset
# ConnectionResetError happens on FreeBSD with Python 3.4
self.__conn.close()
self.__conn.request(method, path, postdata, headers)
return self._get_response()