mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4175 from stephenfin/the-great-toxification-5
The great toxification (part 5)
This commit is contained in:
@@ -39,9 +39,8 @@ install:
|
||||
- pip install -U pip setuptools
|
||||
- pip install docutils==$DOCUTILS
|
||||
- pip install .[test,websupport]
|
||||
- pip install flake8
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install mypy typed-ast; fi
|
||||
script:
|
||||
- flake8
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make type-check test-async; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make type-check test; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi
|
||||
|
||||
4
Makefile
4
Makefile
@@ -69,11 +69,11 @@ reindent:
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@cd tests; $(PYTHON) run.py --ignore py35 -v $(TEST)
|
||||
@cd tests; $(PYTHON) run.py -v $(TEST)
|
||||
|
||||
.PHONY: test-async
|
||||
test-async:
|
||||
@cd tests; $(PYTHON) run.py -v $(TEST)
|
||||
@echo "This target no longer does anything and will be removed imminently"
|
||||
|
||||
.PHONY: covertest
|
||||
covertest:
|
||||
|
||||
1
setup.py
1
setup.py
@@ -72,6 +72,7 @@ extras_require = {
|
||||
'pytest',
|
||||
'pytest-cov',
|
||||
'html5lib',
|
||||
'flake8',
|
||||
],
|
||||
'test:python_version<"3"': [
|
||||
'enum34',
|
||||
|
||||
@@ -8,12 +8,20 @@
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from sphinx.testing.path import path
|
||||
|
||||
pytest_plugins = 'sphinx.testing.fixtures'
|
||||
|
||||
# Exclude 'roots' dirs for pytest test collector
|
||||
collect_ignore = ['roots']
|
||||
|
||||
# Disable Python version-specific
|
||||
if sys.version_info < (3, 5):
|
||||
collect_ignore += ['py35']
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def rootdir():
|
||||
|
||||
11
tests/run.py
11
tests/run.py
@@ -55,14 +55,5 @@ os.makedirs(tempdir)
|
||||
print('Running Sphinx test suite (with Python %s)...' % sys.version.split()[0])
|
||||
sys.stdout.flush()
|
||||
|
||||
# exclude 'roots' dirs for pytest test collector
|
||||
ignore_paths = [
|
||||
os.path.relpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), sub))
|
||||
for sub in ('roots',)
|
||||
]
|
||||
args = sys.argv[1:]
|
||||
for ignore_path in ignore_paths:
|
||||
args.extend(['--ignore', ignore_path])
|
||||
|
||||
import pytest # NOQA
|
||||
sys.exit(pytest.main(args))
|
||||
sys.exit(pytest.main(sys.argv[1:]))
|
||||
|
||||
@@ -9,11 +9,25 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def has_binary(binary):
|
||||
try:
|
||||
subprocess.check_output([binary])
|
||||
except OSError as e:
|
||||
if e.errno == os.errno.ENOENT:
|
||||
# handle file not found error.
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return True
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
'html', testroot='ext-math',
|
||||
confoverrides = {'extensions': ['sphinx.ext.jsmath'], 'jsmath_path': 'dummy.js'})
|
||||
@@ -34,6 +48,8 @@ def test_jsmath(app, status, warning):
|
||||
assert '<div class="math">\na + 1 < b</div>' in content
|
||||
|
||||
|
||||
@pytest.mark.skipif(not has_binary('dvipng'),
|
||||
reason='Requires dvipng" binary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
||||
confoverrides = {'extensions': ['sphinx.ext.imgmath']})
|
||||
def test_imgmath_png(app, status, warning):
|
||||
@@ -49,6 +65,8 @@ def test_imgmath_png(app, status, warning):
|
||||
assert re.search(html, content, re.S)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not has_binary('dvisvgm'),
|
||||
reason='Requires dvisvgm" binary')
|
||||
@pytest.mark.sphinx('html', testroot='ext-math-simple',
|
||||
confoverrides={'extensions': ['sphinx.ext.imgmath'],
|
||||
'imgmath_image_format': 'svg'})
|
||||
|
||||
41
tox.ini
41
tox.ini
@@ -1,6 +1,6 @@
|
||||
[tox]
|
||||
minversion=2.0
|
||||
envlist=flake8,mypy,py{27,34,35,36},pypy,du{11,12,13,14}
|
||||
envlist=docs,flake8,mypy,coverage,py{27,34,35,36,py},du{11,12,13,14}
|
||||
|
||||
[testenv]
|
||||
passenv = https_proxy http_proxy no_proxy
|
||||
@@ -10,35 +10,17 @@ passenv = https_proxy http_proxy no_proxy
|
||||
# https://tox.readthedocs.io/en/latest/config.html#confval-extras=MULTI-LINE-LIST
|
||||
deps =
|
||||
.[test,websupport]
|
||||
du11: docutils==0.11
|
||||
du12: docutils==0.12
|
||||
du13: docutils==0.13.1
|
||||
du14: docutils==0.14
|
||||
setenv =
|
||||
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
|
||||
coverage: PYTEST_ADDOPTS = --cov sphinx
|
||||
commands=
|
||||
{envpython} -Wall tests/run.py --ignore tests/py35 --cov=sphinx \
|
||||
--durations 25 {posargs}
|
||||
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
||||
|
||||
[testenv:du11]
|
||||
deps=
|
||||
docutils==0.11
|
||||
{[testenv]deps}
|
||||
|
||||
[testenv:du12]
|
||||
deps=
|
||||
docutils==0.12
|
||||
{[testenv]deps}
|
||||
|
||||
[testenv:du13]
|
||||
deps=
|
||||
docutils==0.13.1
|
||||
{[testenv]deps}
|
||||
|
||||
[testenv:du14]
|
||||
deps=
|
||||
docutils==0.14
|
||||
{[testenv]deps}
|
||||
{envpython} -Wall tests/run.py --durations 25 {posargs}
|
||||
|
||||
[testenv:flake8]
|
||||
deps=flake8
|
||||
commands=flake8
|
||||
|
||||
[testenv:pylint]
|
||||
@@ -48,15 +30,6 @@ deps=
|
||||
commands=
|
||||
pylint --rcfile utils/pylintrc sphinx
|
||||
|
||||
[testenv:py27]
|
||||
deps=
|
||||
{[testenv]deps}
|
||||
|
||||
[testenv:py35]
|
||||
commands=
|
||||
{envpython} -Wall tests/run.py --cov=sphinx --durations 25 {posargs}
|
||||
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
||||
|
||||
[testenv:mypy]
|
||||
basepython=python3
|
||||
deps=
|
||||
|
||||
Reference in New Issue
Block a user