diff options
author | Julian Berman <Julian@GrayVines.com> | 2020-08-30 11:34:58 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2020-08-30 12:13:32 -0400 |
commit | 9f25fb301dd2804c3d596a1fb816332473abc6b2 (patch) | |
tree | 47b54101a9b1e74429923b74fd77359b48425f09 /tox.ini | |
parent | a951fc780f43728f22082f338ec54f7eefd9f9a5 (diff) | |
download | jsonschema-9f25fb301dd2804c3d596a1fb816332473abc6b2.tar.gz |
Be able to run coverage on all toxenvs.
Shifts coverage into an optional CLI wrapper that's dropped in
only when enabled via an environment variable.
This means any toxenv can now be wrapped into a coverage run
by running e.g. `tox -e py38-format-coverage` instead of
`tox -e py38-format-tests`.
Credits to @nedbat and @The-Compiler.
Diffstat (limited to 'tox.ini')
-rw-r--r-- | tox.ini | 33 |
1 files changed, 12 insertions, 21 deletions
@@ -10,8 +10,14 @@ skipsdist = True [testenv] changedir = {envtmpdir} +passenv = CODECOV* CI setenv = JSON_SCHEMA_TEST_SUITE = {toxinidir}/json + + coverage,codecov: MAYBE_COVERAGE = coverage run -m + coverage,codecov: COVERAGE_RCFILE={toxinidir}/.coveragerc + coverage,codecov: COVERAGE_DEBUG_FILE={envtmpdir}/coverage-debug + coverage,codecov: COVERAGE_FILE={envtmpdir}/coverage-data whitelist_externals = mkdir commands = @@ -19,9 +25,14 @@ commands = format: {envpython} -m pip install '{toxinidir}[format]' format_nongpl: {envpython} -m pip install '{toxinidir}[format_nongpl]' - tests: {envpython} -m twisted.trial {posargs:jsonschema} + tests,coverage: {envpython} -m {env:MAYBE_COVERAGE:} twisted.trial {posargs:jsonschema} tests: {envpython} -m doctest {toxinidir}/README.rst + coverage: {envpython} -m coverage report --show-missing + coverage: {envpython} -m coverage html --directory={envtmpdir}/htmlcov + codecov: {envpython} -m coverage xml -o {envtmpdir}/coverage.xml + codecov: codecov --required --disable gcov --file {envtmpdir}/coverage.xml + perf: mkdir {envtmpdir}/benchmarks/ perf: {envpython} {toxinidir}/jsonschema/benchmarks/issue232.py --inherit-environ JSON_SCHEMA_TEST_SUITE --output {envtmpdir}/benchmarks/issue232.json perf: {envpython} {toxinidir}/jsonschema/benchmarks/json_schema_test_suite.py --inherit-environ JSON_SCHEMA_TEST_SUITE --output {envtmpdir}/benchmarks/json_schema_test_suite.json @@ -69,17 +80,6 @@ deps = commands = {envpython} -m flake8 {posargs} {toxinidir}/jsonschema {toxinidir}/docs -[testenv:coverage] -setenv = - {[testenv]setenv} - COVERAGE_DEBUG_FILE={envtmpdir}/coverage-debug - COVERAGE_FILE={envtmpdir}/coverage-data -commands = - {envpython} -m pip install '{toxinidir}[format]' - {envpython} -m coverage run --rcfile={toxinidir}/.coveragerc -m twisted.trial jsonschema - {envpython} -m coverage report --rcfile={toxinidir}/.coveragerc --show-missing - {envpython} -m coverage html --directory={envtmpdir}/htmlcov --rcfile={toxinidir}/.coveragerc {posargs} - [testenv:docs-html] basepython = pypy3 commands = {envpython} -m sphinx -b html {toxinidir}/docs/ {envtmpdir}/build {posargs:-a -n -q -T -W} @@ -115,12 +115,3 @@ deps = doc8 pygments pygments-github-lexers - -[testenv:codecov] -passenv = CODECOV* CI -setenv = {[testenv:coverage]setenv} -commands = - {envpython} -m pip install '{toxinidir}[format]' - {envpython} -m coverage run --rcfile={toxinidir}/.coveragerc -m twisted.trial jsonschema - {envpython} -m coverage xml -o {envtmpdir}/coverage.xml - codecov --required --disable gcov --file {envtmpdir}/coverage.xml |