boromir674/so-magic

View on GitHub
tox.ini

Summary

Maintainability
Test Coverage
[tox]
envlist = clean,check,py36-cov,py37-cov,py38-cov
skip_missing_interpreters = true
requires = tox-conda

[pytest]
junit_family = xunit1

[testenv]
description = Install the project dependencies in the environment (as python 
    packages), build so-magic from the code, install it (in the environment) and
     run the test suite using pytest.
basepython = {clean,check}: {env:TOXPYTHON:python3}
passenv =
    *
setenv =
; It will overide variables in passenv in case of collision
    PYTHONPATH={toxinidir}/tests
    PYTHOUNBUFFERED=yes
    PIP_DISABLE_PIP_VERSION_CHECK=1
    VIRTUALENV_NO_DOWNLOAD=0
    TEST_RESULTS_DIR={toxinidir}/test-results
    JUNIT_TEST_RESULTS=junit-test-results.xml
conda_channels = conda-forge
deps =
    -rrequirements/base.txt
    -rrequirements/dev.txt
conda_deps = somoclu
commands = {posargs:pytest --cov --cov-report=term-missing -vv --junitxml={env:TEST_RESULTS_DIR:test-results}/{env:JUNIT_TEST_RESULTS:junit-test-results.xml}}



#### RUN TEST SUITE & MEASURE CODE COVERAGE ####
[testenv:py36-cov]
description = {[testenv]description} Runs against python3.6 and measures code coverage.
basepython = {env:TOXPYTHON:python3.6}

[testenv:py37-cov]
description = {[testenv]description} Runs against python3.7 and measures code coverage.
basepython = {env:TOXPYTHON:python3.7}

[testenv:py38-cov]
description = {[testenv]description} Runs against python3.8 and measures code coverage.
basepython = {env:TOXPYTHON:python3.8}


#### RUN TEST SUITE ####
[nocov]
commands = pytest {posargs:-vv}

[testenv:py36]
description = {[testenv]description} Runs using a python3.6 interpreter.
basepython = {env:TOXPYTHON:python3.6}
commands = {[nocov]commands}

[testenv:py37]
description = {[testenv]description} Runs using a python3.7 interpreter.
basepython = {env:TOXPYTHON:python3.7}
commands = {[nocov]commands}

[testenv:py38]
description = {[testenv]description} Runs using a python3.8 interpreter.
basepython = {env:TOXPYTHON:python3.8}
commands = {[nocov]commands}


#### DEVELOPMENT ####
[testenv:dev]
description = Install dependencies, install so-magic in 'development' mode (
    directly links the source code files, instead of building and installing, so
    that every time you change your code you do not have to re-install before 
    testing) and run the test suite using the python3.8 interpreter.
basepython = {env:TOXPYTHON:python3.8}
use_develop = true
commands = {[nocov]commands}


[testenv:dev-cov]
description = Install dependencies, install so-magic in 'development' mode (
    directly links the source code files, instead of building and installing, so
    that every time you change your code you do not have to re-install before 
    testing) and run the test suite, while measuring code coverage, using the 
    python3.8 interpreter.
basepython = {env:TOXPYTHON:python3.8}
use_develop = true
commands = pytest --cov --cov-report=term-missing {posargs: -vv --junitxml={env:TEST_RESULTS_DIR:test-results}/{env:JUNIT_TEST_RESULTS:junit-test-results.xml}}



#### DOCS ####
[docs-base]
deps =
    -rrequirements/base.txt
    -rrequirements/docs.txt


[testenv:docs]
description = Build the documentation. Read the source .rst and .py files and 
    build ready-to-render/ready-to-serve html (eg you can host it in a 
    'read the docs server'). Before building, any sphinx doctest found is 
    executed. After building, both word spelling and url links proper redirects 
    are checked.
basepython = {env:TOXPYTHON:python3.8}
setenv =
    {[testenv]setenv}
    SPELLCHECK=1
deps = {[docs-base]deps}
use_develop = true
commands =
    sphinx-build {posargs:-E} -b doctest docs {env:DOCS_BUILD_LOCATION:dist/docs}
    sphinx-build {posargs:-E} -b html docs {env:DOCS_BUILD_LOCATION:dist/docs}
    sphinx-build -b spelling docs {env:DOCS_BUILD_LOCATION:dist/docs}
    sphinx-build -b linkcheck docs {env:DOCS_BUILD_LOCATION:dist/docs}
    python -c 'print("View documentation at {env:DOCS_BUILD_LOCATION:dist/docs}/index.html; it is ready to be hosted!")'


[testenv:docs-basic]
description = Build the documentation. Reads the source .rst and .py files and 
    build ready-to-render/ready-to-serve html (eg you can host it in a 
    'read the docs server'). Before building, any sphinx doctest found is 
    executed.
basepython = {env:TOXPYTHON:python3.8}
deps = {[docs-base]deps}
use_develop = true
commands =
    sphinx-build {posargs:-E} -b doctest docs {env:DOCS_BUILD_LOCATION:dist/docs}
    sphinx-build {posargs:-E} -b html docs {env:DOCS_BUILD_LOCATION:dist/docs}
    python -c 'print("View documentation at {env:DOCS_BUILD_LOCATION:dist/docs}/index.html; it is ready to be hosted!")'


[testenv:linkcheck]
description = Check all url links existing in the documentation pages that they 
    indeed redirect to resource on the web, when clicked. Any found errors are 
    stored in the {env:DOCS_BUILD_LOCATION:dist/docs}/output.txt file.
basepython = {env:TOXPYTHON:python3.8}
deps = -rrequirements/docs.txt
use_develop = true
commands = sphinx-build {posargs:-E} -b linkcheck docs {env:DOCS_BUILD_LOCATION:dist/docs}