Only require Mock on Python 3.4 and older. Use the builtin one elsewhere.

Mock 2.0 is using pbr which is hostile to environments without network access.
It's not required on Python 3.5+ so I made it possible to use `unittest.mock`
on this version.

Updated tox.ini to reflect this. Tested with 2.7.11, 3.3.6, 3.4.5, and 3.5.2 on
macOS 10.12.1 with tox and pyenv.
This commit is contained in:
Lukasz Langa 2016-11-27 13:26:42 -08:00
parent b8ce1334d0
commit 01c0c648e1
21 changed files with 95 additions and 31 deletions

30
tox.ini
View file

@ -4,14 +4,20 @@ envlist = py27,py33,py34,py35,flake8,linters,docs
[testenv]
deps =
mock>=2.0.0
pytest
coverage
mock>=2.0.0
commands =
coverage run --parallel-mode -m pytest {posargs}
coverage combine
coverage report -m
[testenv:py35]
# No mock needed on 3.5+
deps =
pytest
coverage
[testenv:venv]
deps =
.
@ -31,7 +37,7 @@ commands =
# Linters
[testenv:flake8]
basepython = python3
basepython = python3.5
skip_install = true
deps =
flake8
@ -41,7 +47,7 @@ commands =
flake8 src/flake8/ tests/ setup.py
[testenv:pylint]
basepython = python3
basepython = python3.5
skip_install = true
deps =
pyflakes
@ -50,7 +56,7 @@ commands =
pylint src/flake8
[testenv:doc8]
basepython = python3
basepython = python3.5
skip_install = true
deps =
sphinx
@ -59,7 +65,7 @@ commands =
doc8 docs/source/
[testenv:mypy]
basepython = python3
basepython = python3.5
skip_install = true
deps =
mypy-lang
@ -67,7 +73,7 @@ commands =
mypy flake8
[testenv:bandit]
basepython = python3
basepython = python3.5
skip_install = true
deps =
bandit
@ -75,7 +81,7 @@ commands =
bandit -r src/flake8/ -c .bandit.yml
[testenv:linters]
basepython = python3
basepython = python3.5
skip_install = true
deps =
{[testenv:flake8]deps}
@ -92,7 +98,7 @@ commands =
# Documentation
[testenv:docs]
basepython = python3
basepython = python3.5
deps =
-rdocs/source/requirements.txt
commands =
@ -100,7 +106,7 @@ commands =
sphinx-build -E -W -c docs/source/ -b man docs/source/ docs/build/man
[testenv:serve-docs]
basepython = python3
basepython = python3.5
skip_install = true
changedir = docs/build/html
deps =
@ -108,7 +114,7 @@ commands =
python -m http.server {posargs}
[testenv:readme]
basepython = python3
basepython = python3.5
deps =
readme_renderer
commands =
@ -116,7 +122,7 @@ commands =
# Release tooling
[testenv:build]
basepython = python3
basepython = python3.5
skip_install = true
deps =
wheel
@ -125,7 +131,7 @@ commands =
python setup.py -q sdist bdist_wheel
[testenv:release]
basepython = python3
basepython = python3.5
skip_install = true
deps =
{[testenv:build]deps}