Merged in lukmdo/flake8/switch_use_unitest (pull request #48)

Use unittest.mock if available
This commit is contained in:
Ian Cordasco 2014-09-09 20:32:01 -05:00
commit 475b5a386e
2 changed files with 17 additions and 2 deletions

View file

@ -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__

View file

@ -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',
)