Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop mock dependency; standardize on unittest.mock #621

Merged
merged 2 commits into from May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

- Add warning for recently deprecated s3 parameters (PR [#618](https://github.com/RaRe-Technologies/smart_open/pull/618), [@mpenkov](https://github.com/mpenkov))
- Add new top-level compression parameter (PR [#609](https://github.com/RaRe-Technologies/smart_open/pull/609), [@dmcguire81](https://github.com/dmcguire81))
- Drop mock dependency; standardize on unittest.mock (PR [#621](https://github.com/RaRe-Technologies/smart_open/pull/621), [@musicinmybrain](https://github.com/musicinmybrain))

# 5.0.0, 30 Mar 2021

Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -42,7 +42,6 @@ def read(fname):

all_deps = aws_deps + gcs_deps + azure_deps + http_deps
tests_require = all_deps + [
'mock',
'moto[server]==1.3.14', # Older versions of moto appear broken
'pathlib2',
'responses',
Expand Down
5 changes: 1 addition & 4 deletions smart_open/tests/test_gcs.py
Expand Up @@ -13,10 +13,7 @@
import time
import uuid
import unittest
try:
from unittest import mock
except ImportError:
import mock
from unittest import mock
import warnings
from collections import OrderedDict

Expand Down
3 changes: 1 addition & 2 deletions smart_open/tests/test_hdfs.py
Expand Up @@ -10,10 +10,9 @@
import os.path as P
import subprocess
import unittest
from unittest import mock
import sys

import mock

import smart_open.hdfs

#
Expand Down
7 changes: 3 additions & 4 deletions smart_open/tests/test_s3.py
Expand Up @@ -15,13 +15,12 @@
import unittest
import warnings
from contextlib import contextmanager
from unittest.mock import patch
from unittest import mock
import sys

import boto3
import botocore.client
import botocore.endpoint
import mock
import moto

import smart_open
Expand Down Expand Up @@ -108,7 +107,7 @@ def mock_get(*args, **kwargs):
error_response['Message'] = 'The requested range is not satisfiable'
raise

with patch('smart_open.s3._get', new=mock_get):
with mock.patch('smart_open.s3._get', new=mock_get):
yield


Expand All @@ -123,7 +122,7 @@ def mock_make_request(self, operation_model, *args, **kwargs):
api_calls[operation_model.name] += 1
return _real_make_request(self, operation_model, *args, **kwargs)

patcher = patch('botocore.endpoint.Endpoint.make_request', new=mock_make_request)
patcher = mock.patch('botocore.endpoint.Endpoint.make_request', new=mock_make_request)
patcher.start()
try:
yield api_calls
Expand Down
2 changes: 1 addition & 1 deletion smart_open/tests/test_smart_open.py
Expand Up @@ -17,10 +17,10 @@
from smart_open.compression import INFER_FROM_EXTENSION, NO_COMPRESSION
import tempfile
import unittest
from unittest import mock
import warnings

import boto3
import mock
from moto import mock_s3
import parameterizedtestcase
import pytest
Expand Down
2 changes: 1 addition & 1 deletion smart_open/tests/test_ssh.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

import logging
import mock
import unittest
from unittest import mock

import smart_open.ssh

Expand Down