# HG changeset patch # User Manuel Jacob # Date 1653957365 -7200 # Node ID 425ca3428d0345218eeddb3f187e33f2596b9b3c # Parent 402f9f0f938796a0de33c7569706f70c4e58b13a tests: constant-fold a `pycompat.ispy3` in testlib/badserverext.py diff -r 402f9f0f9387 -r 425ca3428d03 tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py Tue May 31 02:19:07 2022 +0200 +++ b/tests/testlib/badserverext.py Tue May 31 02:36:05 2022 +0200 @@ -49,7 +49,6 @@ import socket from mercurial import ( - pycompat, registrar, ) @@ -335,17 +334,13 @@ object.__getattribute__(self, '_logfp').flush() def _close(self): - # Python 3 uses an io.BufferedIO instance. Python 2 uses some file - # object wrapper. - if pycompat.ispy3: - orig = object.__getattribute__(self, '_orig') + # 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() + if hasattr(orig, 'raw'): + orig.raw._sock.shutdown(socket.SHUT_RDWR) else: - self._sock.shutdown(socket.SHUT_RDWR) + self.close() def read(self, size=-1): cond = object.__getattribute__(self, '_cond')