-
Notifications
You must be signed in to change notification settings - Fork 3
/
tox.ini
78 lines (71 loc) · 2.07 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
[tox]
minversion = 3.25.0
ignore_basepython_conflict = true
# these are the environments that will run when you
# execute `tox` in the command-line
# bellow you will find explanations for all environments
envlist =
build
docs
tests
lint
# configures which environments run with each python version
# the current configuration has the 'test' enviroment. This will run the
# unit test for running python version. It is not needed to state the python
# version because the installation process already ensures only supported
# versions are installed
[testenv]
basepython =
{test,build,docs,lint}: {env:TOXPYTHON:python3}
passenv = *
# configures the unittest environment for python 3.6
[testenv:test]
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
usedevelop = true
extras = test,convenience,units
# before running the tests erases any prerecord of coverage
commands_pre =
coverage erase
# execute pytest
commands =
pytest tests -m "not ipopt" --cov --cov-report=term-missing --cov-append --cov-config=.coveragerc --hypothesis-show-statistics {posargs}
# after executing the pytest assembles the coverage reports
commands_post =
coverage report
coverage html
coverage xml
# in previous verions, I had independent environments to manage the
# coverage reports. However, I found that doing such as pre and post
# commands facilitates many configuration details
# separates lint from build env
[testenv:lint]
deps =
black
ruff
skip_install = true
commands =
black --check --diff {posargs:src tests}
ruff --diff {posargs:src tests doc}
# asserts package build integrity
[testenv:build]
skip_install = true
deps =
build
twine
allowlist_externals = rm
commands_pre =
rm -rf dist/*.whl dist/*.tar.gz || true
commands =
python --version
python -m build
twine check dist/*.whl
twine check dist/*.tar.gz
# Simulate docs building as it will occur on ReadTheDocs
# if this fails, most likely RTD build will fail
[testenv:docs]
package = editable
extras = doc
commands =
sphinx-build {posargs:-E} -b html docs docs/html