From cdd53d20118235ffbf0c14527502aaafefae52ac Mon Sep 17 00:00:00 2001 From: Mahmoud Hashemi Date: Mon, 23 May 2016 02:01:20 -0700 Subject: [PATCH] fix socketutils shutdown test error on OS X (fixing #71) --- tests/test_socketutils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_socketutils.py b/tests/test_socketutils.py index 8e002dc..0c21a4d 100644 --- a/tests/test_socketutils.py +++ b/tests/test_socketutils.py @@ -142,7 +142,13 @@ def test_client_disconnecting(): if sys.platform != 'win32': # Windows socketpairs are kind of bad assert False, 'expected socket.error broken pipe' - by.shutdown(socket.SHUT_RDWR) + try: + by.shutdown(socket.SHUT_RDWR) + except socket.error: + # Mac sockets are already shut down at this point. See #71. + if sys.platform != 'darwin': + raise + by.close() assert not by.getsendbuffer()