diff --git a/Makefile b/Makefile index 77169d0..6662ca6 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ include release.mk bin/py.test: | bin/pip - bin/pip install pytest mock + bin/pip install pytest 'mock;python_version<"3.3"' ln -sfr .venv/$@ $@ bin/restview: setup.py | bin/pip diff --git a/setup.py b/setup.py index 2e3a16c..4b1c9d6 100755 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ setup( install_requires=['docutils', 'readme_renderer', 'pygments'], extras_require={'syntax': []}, test_suite='restview.tests.test_suite', - tests_require=['mock'], + tests_require=['mock;python_version<"3.3"'], zip_safe=False, entry_points=""" [console_scripts] diff --git a/src/restview/tests.py b/src/restview/tests.py index 34a4c81..fe405f2 100644 --- a/src/restview/tests.py +++ b/src/restview/tests.py @@ -10,7 +10,11 @@ try: except ImportError: from io import StringIO -from mock import Mock, patch +try: + from unittest.mock import Mock, patch +except ImportError: + from mock import Mock, patch + import docutils.utils from restview.restviewhttp import (MyRequestHandler, RestViewer, diff --git a/tox.ini b/tox.ini index 32d92f3..d331517 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = [testenv] deps = - mock + mock;python_version<"3.3" pytest commands = py.test {posargs}