summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Falcão <gabrielfalcao@users.noreply.github.com>2020-11-24 15:57:48 +0100
committerGitHub <noreply@github.com>2020-11-24 15:57:48 +0100
commitaa7e7b710368476968be0572e3b5836c5f9efdc1 (patch)
tree4b2ea20d7613bdba6dfd1d2ec74257172c7bc493
parentb0f07918499183122b08e7e09bccdf1b502abe2b (diff)
parent1517b022e0ba8d7cdf6aeb6e3022d3e129b0c53b (diff)
downloadhttpretty-aa7e7b710368476968be0572e3b5836c5f9efdc1.tar.gz
Merge pull request #410 from vphilippon/urllib3-126-compat
closes #411
-rw-r--r--httpretty/core.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/httpretty/core.py b/httpretty/core.py
index 8313354..bd04d6e 100644
--- a/httpretty/core.py
+++ b/httpretty/core.py
@@ -703,6 +703,14 @@ class fakesock(object):
# calls (or can they?)
self.truesock = self.create_socket()
elif not self.truesock:
+ # Special case for
+ # `hasattr(sock, "version")` call added in urllib3>=1.26.
+ if name == 'version':
+ raise AttributeError(
+ "HTTPretty synthesized this error to fix urllib3 compatibility "
+ "(see issue https://github.com/gabrielfalcao/HTTPretty/issues/409). "
+ "Please open an issue if this error causes further unexpected issues."
+ )
raise UnmockedError()
return getattr(self.truesock, name)