From 1c820e8464519e9ec20b9b8cd858c055908100db Mon Sep 17 00:00:00 2001 From: Giorgio Salluzzo Date: Mon, 3 Feb 2020 11:24:15 +0100 Subject: [PATCH 1/2] Fix for removing `DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc'.` --- mocket/compat.py | 2 ++ mocket/mocket.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mocket/compat.py b/mocket/compat.py index 5a0172cc..9049dc90 100644 --- a/mocket/compat.py +++ b/mocket/compat.py @@ -14,6 +14,7 @@ PY2 = sys.version_info[0] == 2 if PY2: + import collections as collections_abc from BaseHTTPServer import BaseHTTPRequestHandler from urlparse import urlsplit, parse_qs, unquote @@ -29,6 +30,7 @@ def unquote_utf8(qs): FileNotFoundError = IOError BlockingIOError = sock_error else: + import collections.abc as collections_abc from http.server import BaseHTTPRequestHandler from urllib.parse import urlsplit, parse_qs, unquote as unquote_utf8 diff --git a/mocket/mocket.py b/mocket/mocket.py index 8f125666..aaeeb94a 100644 --- a/mocket/mocket.py +++ b/mocket/mocket.py @@ -23,6 +23,7 @@ JSONDecodeError, basestring, byte_type, + collections_abc, decode_from_bytes, encode_to_bytes, text_type, @@ -543,7 +544,7 @@ def __init__(self, location, responses): self.location = location self.response_index = 0 - if not isinstance(responses, collections.Iterable) or isinstance( + if not isinstance(responses, collections_abc.Iterable) or isinstance( responses, basestring ): responses = [responses] From 19860cf38619afef7db3f61232be8d41f74524bb Mon Sep 17 00:00:00 2001 From: Giorgio Salluzzo Date: Mon, 3 Feb 2020 11:29:06 +0100 Subject: [PATCH 2/2] Bump version [ci skip]. --- mocket/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mocket/__init__.py b/mocket/__init__.py index 0267d8c9..0ea2db6c 100644 --- a/mocket/__init__.py +++ b/mocket/__init__.py @@ -7,4 +7,4 @@ __all__ = ("mocketize", "Mocket", "MocketEntry", "Mocketizer") -__version__ = "3.8.1" +__version__ = "3.8.2"