mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Merged in lukmdo/flake8/switch_use_unitest (pull request #48)
Use unittest.mock if available
This commit is contained in:
commit
475b5a386e
2 changed files with 17 additions and 2 deletions
|
|
@ -1,7 +1,10 @@
|
|||
from __future__ import with_statement
|
||||
|
||||
import unittest
|
||||
import mock
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock # < PY33
|
||||
|
||||
from flake8 import engine, util, __version__
|
||||
|
||||
|
|
|
|||
14
setup.py
14
setup.py
|
|
@ -8,6 +8,18 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
# Use https://docs.python.org/3/library/unittest.mock.html
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
# < Python 3.3
|
||||
mock = None
|
||||
|
||||
|
||||
tests_require = ['nose']
|
||||
if mock is None:
|
||||
tests_require += ['mock']
|
||||
|
||||
|
||||
def get_version(fname='flake8/__init__.py'):
|
||||
with open(fname) as f:
|
||||
|
|
@ -58,6 +70,6 @@ setup(
|
|||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: Software Development :: Quality Assurance",
|
||||
],
|
||||
tests_require=['nose', 'mock'],
|
||||
tests_require=tests_require,
|
||||
test_suite='nose.collector',
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue