From 1274d869f68fe677893cfc4af23464f596f788a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Fri, 30 Apr 2021 15:08:27 +0200 Subject: [PATCH] Replace usage of mock with unittest.mock (#1054) Since Python 3, the mock dependency is no more required as it is already part of the unittest module. --- requirements-dev.txt | 1 - setup.py | 1 - tests/test_auth.py | 2 +- tests/test_auth_plugins.py | 2 +- tests/test_downloads.py | 2 +- tests/test_errors.py | 2 +- tests/test_exit_status.py | 2 +- tests/test_output.py | 2 +- tests/test_sessions.py | 2 +- 9 files changed, 7 insertions(+), 9 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 8e755e73..cf5f228a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,3 @@ -mock pytest pytest-cov pytest-httpbin>=0.0.6 diff --git a/setup.py b/setup.py index 1777858d..e3ee9e77 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,6 @@ class PyTest(TestCommand): tests_require = [ 'pytest-httpbin', 'pytest', - 'mock', ] diff --git a/tests/test_auth.py b/tests/test_auth.py index e187bcea..ad63696d 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -1,5 +1,5 @@ """HTTP authentication-related tests.""" -import mock +from unittest import mock import pytest from httpie.plugins.builtin import HTTPBasicAuth diff --git a/tests/test_auth_plugins.py b/tests/test_auth_plugins.py index b21d813e..cf491973 100644 --- a/tests/test_auth_plugins.py +++ b/tests/test_auth_plugins.py @@ -1,4 +1,4 @@ -from mock import mock +from unittest import mock from httpie.cli.constants import SEPARATOR_CREDENTIALS from httpie.plugins import AuthPlugin diff --git a/tests/test_downloads.py b/tests/test_downloads.py index 969021d9..4b1d8805 100644 --- a/tests/test_downloads.py +++ b/tests/test_downloads.py @@ -1,10 +1,10 @@ import os import tempfile import time +from unittest import mock from urllib.request import urlopen import pytest -import mock from requests.structures import CaseInsensitiveDict from httpie.downloads import ( diff --git a/tests/test_errors.py b/tests/test_errors.py index ec6ca5a4..34250609 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock from pytest import raises from requests import Request from requests.exceptions import ConnectionError diff --git a/tests/test_exit_status.py b/tests/test_exit_status.py index abc93518..57e14633 100644 --- a/tests/test_exit_status.py +++ b/tests/test_exit_status.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock from httpie.status import ExitStatus from utils import MockEnvironment, http, HTTP_OK diff --git a/tests/test_output.py b/tests/test_output.py index d5b15e46..ef340c2a 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -1,7 +1,7 @@ import argparse from pathlib import Path +from unittest import mock -import mock import json import os import tempfile diff --git a/tests/test_sessions.py b/tests/test_sessions.py index f52c477c..829a9818 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -3,7 +3,7 @@ import json import os import shutil from datetime import datetime -from mock import mock +from unittest import mock from tempfile import gettempdir import pytest