From 634cb776cb934908a1be3029e21d11ed7923ee07 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 12 Nov 2022 18:09:35 +0100 Subject: [PATCH] Use Python's unittest mock Since 3.3 Python unittest module supports mock and the seperate mock module is deprecated. --- dev_requirements.txt | 1 - tests/test_adapter.py | 2 +- tests/test_cache_control.py | 2 +- tests/test_etag.py | 2 +- tests/test_expires_heuristics.py | 2 +- tests/test_serialization.py | 2 +- tests/test_storage_redis.py | 2 +- tox.ini | 1 - 8 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 46d00b04..9f7e250f 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -7,7 +7,6 @@ tox pytest-cov pytest -mock cherrypy sphinx redis diff --git a/tests/test_adapter.py b/tests/test_adapter.py index a6820571..ab21f38f 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -import mock +from unittest import mock import pytest from requests import Session diff --git a/tests/test_cache_control.py b/tests/test_cache_control.py index 63ed3d84..53c2f007 100644 --- a/tests/test_cache_control.py +++ b/tests/test_cache_control.py @@ -6,7 +6,7 @@ Unit tests that verify our caching methods work correctly. """ import pytest -from mock import ANY, Mock +from unittest.mock import ANY, Mock import time from tempfile import mkdtemp diff --git a/tests/test_etag.py b/tests/test_etag.py index 7523bf82..df6df533 100644 --- a/tests/test_etag.py +++ b/tests/test_etag.py @@ -4,7 +4,7 @@ import pytest -from mock import Mock, patch +from unittest.mock import Mock, patch import requests diff --git a/tests/test_expires_heuristics.py b/tests/test_expires_heuristics.py index 475541bd..a946b2ba 100644 --- a/tests/test_expires_heuristics.py +++ b/tests/test_expires_heuristics.py @@ -8,7 +8,7 @@ from email.utils import formatdate, parsedate from datetime import datetime -from mock import Mock +from unittest.mock import Mock from requests import Session, get from cachecontrol import CacheControl diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 4301be46..68f5ba66 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -5,7 +5,7 @@ import msgpack import requests -from mock import Mock +from unittest.mock import Mock from cachecontrol.compat import pickle from cachecontrol.serialize import Serializer diff --git a/tests/test_storage_redis.py b/tests/test_storage_redis.py index 9ada01c6..d0e9a679 100644 --- a/tests/test_storage_redis.py +++ b/tests/test_storage_redis.py @@ -4,7 +4,7 @@ from datetime import datetime -from mock import Mock +from unittest.mock import Mock from cachecontrol.caches import RedisCache diff --git a/tox.ini b/tox.ini index d3768132..99c6e7fa 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,6 @@ python = [testenv] deps = pytest - mock cherrypy redis filelock