requirements: Reduce duplication

Simply installing packages will ensure that most of the dependencies in
'setup.py' are installed, meaning 'test-reqs.txt' need only contain
those necessary for testing.

The only notable change is that the 'simplejson' module is dropped from
the requirements list. This included as a dependency for the PyPy
target, but it appears that this is not necessary today (though it may
have been when the target was added in 2011).

This retains 'setup.py test' which, as noted in the tox docs [1], is
sometimes expected for downstream distribution testing. We may wish to
find a way to synchronize requirements between 'test-reqs.txt' and this
section in the future, but that's work for another day.

[1] https://tox.readthedocs.io/en/latest/example/basic.html#integration-with-setup-py-test-command

Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
Stephen Finucane 2017-10-03 09:46:28 +01:00
parent dbd58d4c51
commit eb8efce7d8
5 changed files with 20 additions and 43 deletions

View File

@ -18,8 +18,8 @@ environment:
install: install:
- C:\Python%PYTHON%\python.exe -m pip install -U pip setuptools - C:\Python%PYTHON%\python.exe -m pip install -U pip setuptools
- C:\Python%PYTHON%\python.exe -m pip install docutils==%DOCUTILS% - C:\Python%PYTHON%\python.exe -m pip install docutils==%DOCUTILS% mock
- C:\Python%PYTHON%\python.exe -m pip install -r test-reqs.txt - C:\Python%PYTHON%\python.exe -m pip install .[test,websupport]
# No automatic build, just run python tests # No automatic build, just run python tests
build: off build: off

View File

@ -40,7 +40,8 @@ addons:
install: install:
- pip install -U pip setuptools - pip install -U pip setuptools
- pip install docutils==$DOCUTILS - pip install docutils==$DOCUTILS
- pip install -r test-reqs.txt - pip install .[test,websupport]
- pip install flake8
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install mypy typed-ast; fi - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install mypy typed-ast; fi
script: script:
- flake8 - flake8

View File

@ -69,10 +69,17 @@ extras_require = {
], ],
'test': [ 'test': [
'pytest', 'pytest',
'mock', # it would be better for 'test:python_version in 2.7' 'pytest-cov',
'simplejson', # better: 'test:platform_python_implementation=="PyPy"'
'html5lib', 'html5lib',
], ],
'test:python_version<"3"': [
'enum34',
'mock',
],
'test:python_version>="3"': [
'mypy',
'typed_ast',
],
} }
# Provide a "compile_catalog" command that also creates the translated # Provide a "compile_catalog" command that also creates the translated
@ -83,9 +90,6 @@ cmdclass = {}
try: try:
from babel.messages.pofile import read_po from babel.messages.pofile import read_po
from babel.messages.frontend import compile_catalog from babel.messages.frontend import compile_catalog
try:
from simplejson import dump
except ImportError:
from json import dump from json import dump
except ImportError: except ImportError:
pass pass

View File

@ -1,20 +1,7 @@
flake8 flake8
pytest>=3.0 pytest>=3.0
pytest-cov pytest-cov
mock
six>=1.4
Jinja2>=2.3
Pygments>=2.0
docutils>=0.11
snowballstemmer>=1.1
babel
sqlalchemy>=0.9
whoosh>=2.0
alabaster
sphinx_rtd_theme
sphinxcontrib-websupport
imagesize
requests
html5lib html5lib
enum34 mock;python_version<'3.3'
typing mypy;python_version>='3.2'
typed_ast;python_version>='3.2'

21
tox.ini
View File

@ -1,16 +1,10 @@
[tox] [tox]
envlist=flake8,py27,py34,py35,py36,pypy,du14,du13,du12,du11 minversion=2.0
envlist=flake8,mypy,py{27,34,35,36},pypy,du{11,12,13,14}
[testenv] [testenv]
passenv = https_proxy http_proxy no_proxy passenv = https_proxy http_proxy no_proxy
deps= deps=-rtest-reqs.txt
six
pytest
pytest-cov
html5lib
mock
enum34
typing
setenv = setenv =
SPHINX_TEST_TEMPDIR = {envdir}/testbuild SPHINX_TEST_TEMPDIR = {envdir}/testbuild
commands= commands=
@ -18,11 +12,6 @@ commands=
--durations 25 {posargs} --durations 25 {posargs}
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
[testenv:pypy]
deps=
simplejson
{[testenv]deps}
[testenv:du11] [testenv:du11]
deps= deps=
docutils==0.11 docutils==0.11
@ -59,10 +48,6 @@ deps=
{[testenv]deps} {[testenv]deps}
[testenv:py35] [testenv:py35]
deps=
mypy
typed_ast
{[testenv]deps}
commands= commands=
{envpython} -Wall tests/run.py --cov=sphinx --durations 25 {posargs} {envpython} -Wall tests/run.py --cov=sphinx --durations 25 {posargs}
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html