Unbabel/OpenKiwi

View on GitHub
tox.ini

Summary

Maintainability
Test Coverage
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
isolated_build = true
skip_missing_interpreters = true
parallel_show_output = true
envlist = lint,py37,docs

[testenv]
whitelist_externals =
    poetry
skip_install = true
setenv =
    PYTHONHASHSEED=0
    PYTHONPATH={toxinidir}
;commands =
;    poetry install -v
;    {[testenv:test]commands}

[testenv:test]
skip_install = true
usedevelop = true
envdir = {toxworkdir}/py37
commands =
    poetry install -v -E search -E mlflow
    poetry run coverage erase
    poetry run pytest --cov=kiwi --cov-report term --cov-report xml --cov-append {posargs:tests}

[testenv:lint]
skip_install = true
usedevelop = true
envdir = {toxworkdir}/py37
commands =
    poetry install -v
    poetry run flake8 {posargs:kiwi}
    poetry run black --check {posargs:kiwi}
    poetry run isort --check-only --diff --recursive {posargs:kiwi}

[testenv:py37]
commands =
    poetry install -v
    {[testenv:test]commands}

[testenv:docs]
skip_install = true
usedevelop = true
;envdir = {toxworkdir}/docs
envdir = {toxworkdir}/py37
changedir = {toxinidir}/docs
commands =
    poetry install -v
;    poetry run sphinx-apidoc -f -o source {toxinidir}/kiwi
    poetry run sphinx-build -b html -d ./.doctrees . ../public


[testenv:gh-pages]
skip_install = true
usedevelop = true
envdir = {toxworkdir}/py37
commands =
    poetry install -v
;    poetry run sphinx-apidoc -f -o docs/source {toxinidir}/kiwi
    poetry run sphinx-build -b html -d docs/.doctrees docs gh-pages

# Other packages config

[flake8]
max_line_length = 88
select = C,E,F,W,B,B950
ignore = W503,E203

[pytest]
python_files =
    test_*.py
    *_test.py
    tests.py
norecursedirs =
    .git
    .tox
    .env
    dist
    build

[coverage:run]
branch = true
parallel = true
omit =
    kiwi/__main__.py

[coverage:report]
exclude_lines =
    pragma: no cover
    if __name__ == .__main__.: