setup.py: add "testing" extra requirement

Use this in tox to stream-line base testing requirements.

Closes https://github.com/pytest-dev/pytest/issues/4410.
This commit is contained in:
Daniel Hahler 2018-11-18 01:15:54 +01:00
parent 10cdae8e38
commit e46f995cc7
2 changed files with 14 additions and 10 deletions

View File

@ -29,6 +29,16 @@ def main():
use_scm_version={"write_to": "src/_pytest/_version.py"}, use_scm_version={"write_to": "src/_pytest/_version.py"},
setup_requires=["setuptools-scm", "setuptools>=40.0"], setup_requires=["setuptools-scm", "setuptools>=40.0"],
package_dir={"": "src"}, package_dir={"": "src"},
# fmt: off
extras_require={
"testing": [
"hypothesis>=3.56",
"nose",
"requests",
"mock;python_version=='2.7'",
],
},
# fmt: on
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
) )

14
tox.ini
View File

@ -28,11 +28,8 @@ setenv =
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
extras = testing
deps = deps =
hypothesis>=3.56
nose
{py27,pypy}: mock
requests
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
[testenv:py27-subprocess] [testenv:py27-subprocess]
@ -51,22 +48,19 @@ deps = pre-commit>=1.11.0
commands = pre-commit run --all-files --show-diff-on-failure commands = pre-commit run --all-files --show-diff-on-failure
[testenv:py27-xdist] [testenv:py27-xdist]
extras = testing
deps = deps =
pytest-xdist>=1.13 pytest-xdist>=1.13
{py27,pypy}: mock
nose
hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto {posargs} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto {posargs}
[testenv:py37-xdist] [testenv:py37-xdist]
# NOTE: copied from above due to https://github.com/tox-dev/tox/issues/706. # NOTE: copied from above due to https://github.com/tox-dev/tox/issues/706.
extras = testing
deps = deps =
pytest-xdist>=1.13 pytest-xdist>=1.13
{py27,pypy}: mock {py27,pypy}: mock
nose
hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
commands = {[testenv:py27-xdist]commands} commands = {[testenv:py27-xdist]commands}
@ -84,9 +78,9 @@ deps = {[testenv:py27-pexpect]deps}
commands = {[testenv:py27-pexpect]commands} commands = {[testenv:py27-pexpect]commands}
[testenv:py27-nobyte] [testenv:py27-nobyte]
extras = testing
deps = deps =
pytest-xdist>=1.13 pytest-xdist>=1.13
hypothesis>=3.56
py27: mock py27: mock
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
distribute = true distribute = true