Skip to content

Commit 8cff1aa

Browse files
authored
Merge pull request Kludex#18 from carlwgeorge/stdlib-mock
Use standard library mock when available
2 parents ea08465 + a027deb commit 8cff1aa

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

multipart/tests/test_multipart.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from io import BytesIO
1717
from six import binary_type, text_type
1818

19-
from mock import MagicMock, Mock, patch
19+
try:
20+
from unittest.mock import MagicMock, Mock, patch
21+
except ImportError:
22+
from mock import MagicMock, Mock, patch
2023

2124
from ..multipart import *
2225

setup.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
version_re = re.compile(r'((?:\d+)\.(?:\d+)\.(?:\d+))')
1717
version = version_re.search(version_data).group(0)
1818

19+
tests_require = [
20+
'pytest',
21+
'pytest-cov',
22+
'PyYAML'
23+
]
24+
25+
if sys.version_info[0:2] < (3, 3):
26+
tests_require.append('mock')
27+
1928
setup(name='python-multipart',
2029
version=version,
2130
description='A streaming multipart parser for Python',
@@ -27,12 +36,7 @@
2736
install_requires=[
2837
'six>=1.4.0',
2938
],
30-
tests_require=[
31-
'pytest',
32-
'pytest-cov',
33-
'Mock',
34-
'PyYAML'
35-
],
39+
tests_require=tests_require,
3640
packages=[
3741
'multipart',
3842
'multipart.tests',

0 commit comments

Comments
 (0)