According to the docs
tests_require are additional packages that are obtained when using setuptools's test command. They are not installed on the system.
extras_require are optional additional packages grouped by the feature name. The list of packages are installed to use that feature and there are various ways to install them. See Does pip handle extras_requires from setuptools/distribute based sources?
My interpretation
tests_require should be packages that are used in the tests such as numpy and not packages that are used to conduct testing like pytest or nose. tests_require would need to be moved or copied to a "testing" feature in extras_require when testing outside of setuptools.
Use extras_require to make a testing package such as pytest optional. Use setup_requires to require it.
pytest and nose can be integrated with setuptools to take advantage of the convenience of tests_require, however, there may be drawbacks. nose warns that plugins may not be available when run through setuptools.
See Integrating with setuptools / python setup.py test
/ pytest-runner
and nosetests setuptools command.
For example
Testing with setuptools integration:
setup.py
[...]
'version': '0.0.1',
'install_requires': [],
'tests_require': ['numpy'],
'cmdclass': {'test': PyTest},
'extras_require': {
'testing': ['pytest'],
},
[...]
sh
(env) > python setup.py develop
(env) > easy_install pytest
(env) > python setup.py test -a "--pdb"
Or, testing without setuptools integration:
setup.py
[...]
'version': '0.0.1',
'install_requires': [],
'extras_require': {
'testing': ['pytest', 'numpy'],
},
[...]
sh
(env) > pip install -e .[testing]
(env) > pytest.py --pdb