-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathtox.ini
More file actions
113 lines (92 loc) · 3.04 KB
/
tox.ini
File metadata and controls
113 lines (92 loc) · 3.04 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Automated testing.
# https://tox.wiki/en/latest/config.html
# NOTE: Since we don't use clean and --cov-append, the tests coverage is from the
# last python env that is run. Shouldn't be a problem though since we expect similar
# coverage from all python env (we don't branch much on python version).
# NOTE: The coverage report doesn't include the files in the scons/ directory
# which are run in a subprocess. This includes python files such as
# scons_util.py and the SConstruct files.
# Useful commands
#
# Run everything:
# tox
#
# Lint only:
# tox -e lint
#
# Test only (in decreasing scope size)
# tox --skip-env lint
# tox -e py313
# tox -e py313 -- test/unit_tests
# tox -e py313 -- test/unit_tests/commands
# tox -e py313 -- test/unit_tests/commands/test_examples.py
# tox -e py313 -- test/unit_tests/commands/test_examples.py::test_examples
#
# Installing python interpreters
# Mac: brew install python@3.12
# Win: ???
# Linux: ???
# ----------------------------------------------------
[tox]
isolated_build = True
# Runs testenv:x for each env x here. Listing in increasing order
# since more compatibility errors happens with the older version.
envlist =
lint
py311
py312
py313
py314
# ----------------------------------------------------
# Lints the apio code and tests.
[testenv:lint]
deps =
# For validating the mkdocs docs at ./docs
mkdocs-material==9.6.14
# For linting the python code.
black==25.1.0
flake8==7.2.0
pylint==3.3.7
pytest==8.4.2
setenv=
LINT_ITEMS = apio tests scripts tasks.py
# When we generate the proto files at apio/proto, we also patch at the top
# directives to suppress pylint warnings.
#
# See .pylintrc for pylint's configuration.
commands =
# Check the docs for errors.
mkdocs build --strict
# Check python for lint errors.
black {env:LINT_ITEMS} --exclude apio/common/proto
flake8 {env:LINT_ITEMS} --exclude apio/common/proto
pylint {env:LINT_ITEMS}
# ----------------------------------------------------
# Runs the test that don't require connected boards.
# This is a template for the pyxx envs listed above..
[testenv]
deps =
pytest==8.4.2
pytest-cov==7.0.0
# Pass these env vars, if defined, to the test environment.
# See env_options.py for the list of env variable Apio recognizes.
passenv =
APIO_DEBUG
APIO_REMOTE_CONFIG_URL
setenv =
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
COVERAGE_FILE = {toxworkdir}/.coverage
# Testing while treating warnings as errors. Also, generating coverage report.
# -vv provides more details error messages.
# --duration=N prints the N slowest steps.
#
# For test coverage report add these flags or use 'invoke test-coverage' which
# adds the pytest flags --cov --cov-report=html:_pytest-coverage. Generating
# the test coverage report makes the tests slower.
commands =
python -B -m pytest \
-W error \
-vv \
apio tests/first_test.py tests/unit_tests tests/integration_tests \
{posargs}
# ----------------------------------------------------