-
Notifications
You must be signed in to change notification settings - Fork 7
/
tox.ini
94 lines (80 loc) · 2.66 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# tests suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
skipsdist = true
envlist = py{38,39}-pytest, py39-{yaml,flake8,black,mypy,coverage-report,docs}
toxworkdir = /tmp/.tox.yacfg/
[flake8]
max-line-length = 160
exclude = .*, tests/*, docs/*, venv/*
max-complexity = 10
[gh-actions]
python =
3.7: py37-pytest
3.8: py38-pytest
3.9: py39-pytest, py39-flake8, py39-yaml, py39-mypy, py39-docs
[testenv:base]
basepython = python3.9
[testenv:pytest]
description = Run tests and measure coverage
commands =
poetry run pytest -ra -vv --cov=yacfg --cov=yacfg_batch --cov-report=xml --basetemp="{envtmpdir}" {posargs}
mkdir -p {toxinidir}/.coverage-reports
mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
[testenv]
extras = testing
setenv =
PYTHONUNBUFFERED=yes
COVERAGE_FILE={envtmpdir}/.coverage
allowlist_externals =
mv
mkdir
bash
poetry
commands =
poetry install -v
pytest: {[testenv:pytest]commands}
flake8: {[testenv:flake8]commands}
yaml: {[testenv:yaml]commands}
mypy: {[testenv:mypy]commands}
docs: {[testenv:docs]commands}
coverage-report: {[testenv:coverage-report]commands}
profile-test: {[testenv:profile-test]commands}
[testenv:flake8]
basepython = {[testenv:base]basepython}
commands = poetry run flake8 --exit-zero
[testenv:yaml]
description = Check yaml syntax
basepython = {[testenv:base]basepython}
commands = poetry run yamllint .
[testenv:mypy]
description = Check types
basepython = {[testenv:base]basepython}
commands = poetry run mypy src --ignore-missing-imports
[testenv:pre-commit]
description = Run all pre-commit hooks
basepython = {[testenv:base]basepython}
commands = poetry run pre-commit {posargs:run --all-files}
[testenv:profile-test]
basepython = {[testenv:base]basepython}
commands = poetry run bash profile_test.sh
[testenv:docs]
description = Build docs
basepython = {[testenv:base]basepython}
extras = docs
commands = poetry run jupyter-book build ./docs
[testenv:black]
description = Black formatter
basepython = {[testenv:base]basepython}
commands = poetry run black --check ./
[testenv:coverage-report]
description = Report coverage over all test runs
basepython = {[testenv:base]basepython}
setenv =
COVERAGE_FILE = {toxinidir}/.coverage-reports/.coverage
commands =
poetry run coverage combine {toxinidir}/.coverage-reports/
poetry run coverage html --directory={toxinidir}/.coverage-reports/
poetry run coverage report --show-missing