commit 22c076d9a6eade66e5fc5bd2ace64aea0438f7be Author: Damian Johnson atagar@torproject.org Date: Tue Jul 21 15:39:25 2020 -0700
Drop obsolete test.network mockey patch reference
Originally the test.network module monkey patched python's socket module, but it stopped doing that long ago. As such there is no longer a need to keep an original socket reference. --- test/network.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/test/network.py b/test/network.py index 5fea625e..4216d743 100644 --- a/test/network.py +++ b/test/network.py @@ -20,10 +20,6 @@ import stem import stem.util.connection import stem.util.str_tools
-# Store a reference to the original class so we can find it after -# monkey patching. -_socket_socket = socket.socket - SOCKS5_NOAUTH_GREETING = (0x05, 0x01, 0x00) SOCKS5_NOAUTH_RESPONSE = (0x05, 0x00) SOCKS5_CONN_BY_IPV4 = (0x05, 0x01, 0x00, 0x01) @@ -78,7 +74,7 @@ class SocksError(ProxyError): return '[%s] %s' % (code, self._ERROR_MESSAGE[code])
-class Socks(_socket_socket): +class Socks(socket.socket): """ A **socket.socket**-like interface through a SOCKS5 proxy connection. Tor does not support proxy authentication, so neither does this class. @@ -111,7 +107,7 @@ class Socks(_socket_socket): :returns: :class:`~test.network.Socks` """
- _socket_socket.__init__(self, family, type_, proto, _sock) + socket.socket.__init__(self, family, type_, proto, _sock) self._proxy_addr = proxy_addr
def __enter__(self, *args, **kwargs): @@ -187,7 +183,7 @@ class Socks(_socket_socket): :raises: :class:`test.SocksError` for any errors """
- _socket_socket.connect(self, (self._proxy_addr[0], self._proxy_addr[1])) + socket.socket.connect(self, (self._proxy_addr[0], self._proxy_addr[1]))
# ask for non-authenticated connection