From c5dec1b6a97c627602df62e22cd134bad7db363e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 5 Oct 2017 09:16:05 +0100 Subject: [PATCH 1/6] tox: Add pylint target to tox This isn't enabled by default because it throws so many damn errors. Perhaps we should simply remove this? Signed-off-by: Stephen Finucane --- tox.ini | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tox.ini b/tox.ini index b7d4feb98..04c23580d 100644 --- a/tox.ini +++ b/tox.ini @@ -46,6 +46,13 @@ deps= deps=flake8 commands=flake8 +[testenv:pylint] +deps= + pylint + {[testenv]deps} +commands= + pylint --rcfile utils/pylintrc sphinx + [testenv:py27] deps= {[testenv]deps} From 6d6d3a40f1ccfc666a85de96936e78615ce3704c Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 2 Oct 2017 20:22:35 +0100 Subject: [PATCH 2/6] tox: Always run coverage There is value in examining coverage for something like Sphinx. Start doing this by default, in anticipation of increasing coverage over time. Signed-off-by: Stephen Finucane --- .gitignore | 1 + tox.ini | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c49070f13..f1dc3167c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ TAGS .tags .tox .venv +.coverage .DS_Store sphinx/pycode/Grammar*pickle distribute-* diff --git a/tox.ini b/tox.ini index 04c23580d..411c85ba3 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ passenv = https_proxy http_proxy no_proxy deps= six pytest + pytest-cov html5lib mock enum34 @@ -14,7 +15,7 @@ setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild PYTHONDONTWRITEBYTECODE = true commands= - {envpython} -Wall tests/run.py --ignore tests/py35 {posargs} + {envpython} -Wall tests/run.py --ignore tests/py35 --cov=sphinx {posargs} sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:pypy] @@ -63,7 +64,7 @@ deps= typed_ast {[testenv]deps} commands= - {envpython} -Wall tests/run.py {posargs} + {envpython} -Wall tests/run.py --cov=sphinx {posargs} sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:mypy] From 71a5ec18bebb8dbcc888a2bcf0069a94486cbdd1 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 5 Oct 2017 09:57:58 +0100 Subject: [PATCH 3/6] tox: Always show 25 slowest tests pytest supports this natively [1] and this is what is currently used by Travis. There's value in seeing similar data locally. [1] https://docs.pytest.org/en/latest/usage.html#profiling-test-execution-duration Signed-off-by: Stephen Finucane --- tox.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 411c85ba3..e53175df0 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,8 @@ setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild PYTHONDONTWRITEBYTECODE = true commands= - {envpython} -Wall tests/run.py --ignore tests/py35 --cov=sphinx {posargs} + {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:pypy] @@ -64,7 +65,7 @@ deps= typed_ast {[testenv]deps} commands= - {envpython} -Wall tests/run.py --cov=sphinx {posargs} + {envpython} -Wall tests/run.py --cov=sphinx --durations 25 {posargs} sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:mypy] From 40c8f661ef0c6680e3f3aed321ebded56a3207b6 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 3 Oct 2017 10:04:08 +0100 Subject: [PATCH 4/6] tox: Ensure 'mypy' targets runs with Python 3.x Turns out this requires Python 3.2 at a minimum. Who knew? We don't support Python 3.1 so simply fix to 'python3'. Signed-off-by: Stephen Finucane --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index e53175df0..5a108a700 100644 --- a/tox.ini +++ b/tox.ini @@ -69,6 +69,7 @@ commands= sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:mypy] +basepython=python3 deps= mypy commands= From e023c296e87772ebff1b36ad3ca49b4283c4a8e9 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 3 Oct 2017 10:25:10 +0100 Subject: [PATCH 5/6] tox: Pass posargs to docs This allows us to do something like the following: tox -e docs -- -b man Signed-off-by: Stephen Finucane --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5a108a700..d5f401a7a 100644 --- a/tox.ini +++ b/tox.ini @@ -77,4 +77,4 @@ commands= [testenv:docs] commands= - python setup.py build_sphinx + python setup.py build_sphinx {posargs} From 6086d7b608a365dc3ccfcb37d8bac7f02de338fe Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 3 Oct 2017 10:36:07 +0100 Subject: [PATCH 6/6] tox: Don't bother setting 'PYTHONDONTWRITEBYTECODE' As I've previously discovered [1], this doesn't actually do anything in modern tox. Simply remove it. [1] https://review.openstack.org/#/c/369986/ Signed-off-by: Stephen Finucane --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index d5f401a7a..519020f98 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,6 @@ deps= typing setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild - PYTHONDONTWRITEBYTECODE = true commands= {envpython} -Wall tests/run.py --ignore tests/py35 --cov=sphinx \ --durations 25 {posargs}