# HG changeset patch # User Manuel Jacob # Date 1653958042 -7200 # Node ID 4554e2e965e21002987519c73cf1a40ec2851109 # Parent 425ca3428d0345218eeddb3f187e33f2596b9b3c tests: assume that `raw` attribute is present on original socket file object It seems like the original socket file object is always an io.BufferedIO instance. If not, the code will fail and we should try harder to get the socket object (e.g. if the original socket file object is unbuffered, we can get the `_sock` attribute directly from it). diff -r 425ca3428d03 -r 4554e2e965e2 tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py Tue May 31 02:36:05 2022 +0200 +++ b/tests/testlib/badserverext.py Tue May 31 02:47:22 2022 +0200 @@ -335,12 +335,7 @@ def _close(self): # We wrap an io.BufferedIO instance. - orig = object.__getattribute__(self, '_orig') - - if hasattr(orig, 'raw'): - orig.raw._sock.shutdown(socket.SHUT_RDWR) - else: - self.close() + self.raw._sock.shutdown(socket.SHUT_RDWR) def read(self, size=-1): cond = object.__getattribute__(self, '_cond')