From 61a4a1720bb5d8392411fefbc93a3a58b1f98723 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 24 Jul 2022 02:12:40 +0200 Subject: [PATCH] Use unittest.mock instead of mock (#1673) This module has been included in Python itself since 3.3. Fixes: https://github.com/rq/rq/issues/1646 --- dev-requirements.txt | 1 - tests/test_decorator.py | 2 +- tests/test_queue.py | 2 +- tests/test_scheduler.py | 2 +- tests/test_sentry.py | 2 +- tests/test_utils.py | 2 +- tests/test_worker.py | 4 ++-- tests/test_worker_registration.py | 2 +- tox.ini | 1 - 9 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 066b3d3..a002971 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,4 @@ codecov -mock psutil pytest pytest-cov diff --git a/tests/test_decorator.py b/tests/test_decorator.py index 32eaa91..190f64d 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) -import mock +from unittest import mock from redis import Redis from rq.decorators import job diff --git a/tests/test_queue.py b/tests/test_queue.py index ab94189..a4be208 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -5,7 +5,7 @@ from __future__ import (absolute_import, division, print_function, import json from datetime import datetime, timedelta, timezone from rq.serializers import DefaultSerializer, JSONSerializer -from mock.mock import patch +from unittest.mock import patch from rq import Retry, Queue from rq.job import Job, JobStatus diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 684a076..0aebcf6 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -2,7 +2,7 @@ import os from datetime import datetime, timedelta, timezone from multiprocessing import Process -import mock +from unittest import mock from rq import Queue from rq.compat import PY2 from rq.exceptions import NoSuchJobError diff --git a/tests/test_sentry.py b/tests/test_sentry.py index 2514325..0e3b356 100644 --- a/tests/test_sentry.py +++ b/tests/test_sentry.py @@ -11,7 +11,7 @@ from rq.worker import SimpleWorker from tests import RQTestCase from tests.fixtures import div_by_zero -import mock +from unittest import mock from click.testing import CliRunner diff --git a/tests/test_utils.py b/tests/test_utils.py index a1217ea..ef6724b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -3,7 +3,7 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) import re import datetime -import mock +from unittest import mock from redis import Redis diff --git a/tests/test_worker.py b/tests/test_worker.py index 3f865a2..26caccc 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -20,8 +20,8 @@ from unittest import skipIf import redis.exceptions import pytest -import mock -from mock import Mock +from unittest import mock +from unittest.mock import Mock from tests import RQTestCase, slow from tests.fixtures import ( diff --git a/tests/test_worker_registration.py b/tests/test_worker_registration.py index 2450d64..30a3c82 100644 --- a/tests/test_worker_registration.py +++ b/tests/test_worker_registration.py @@ -1,6 +1,6 @@ from rq.utils import ceildiv from tests import RQTestCase -from mock.mock import patch +from unittest.mock import patch from rq import Queue, Worker from rq.worker_registration import (clean_worker_registry, get_keys, register, diff --git a/tox.ini b/tox.ini index 344eb9a..e6fcbbd 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,6 @@ commands=pytest --cov rq --durations=5 {posargs} deps= pytest pytest-cov - mock [testenv:flake8] basepython = python3.6