-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtox.ini
115 lines (109 loc) · 3.73 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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.
# default tox environments to run
[tox]
skip_missing_interpreters = true
envlist =
lint
python
# base dependencies (basically dev_requirements)
[base]
distdir={toxworkdir}/build
deps =
-r dev_requirements.txt
description =
# py{x} determines python version for environment.
# A valid interpreter must be installed (and added to PATH)
# for each selected version, otherwise the run will be skipped
# list all available tox environments with: `tox -av`
python: Local Python
py38: Python 3.8
py39: Python 3.9
py310: Python 3.10
py311: Python 3.11
py312: Python 3.12
# tox-gh matrix (github action -> tox python environment)
[gh]
python =
3.8 = lint, py38
3.9 = py39
3.10 = py310
3.11 = py311
3.12 = py312
# lint - flake8 and pylint
[testenv:lint]
description = run linter
deps =
{[base]deps}
azure-cli
commands =
flake8 azext_edge/ --statistics --config=setup.cfg
pylint azext_edge/ --rcfile=.pylintrc
# unit tests
[testenv:py{thon,38,39,310,311,312}]
skip_install = True
description =
{[base]description}
deps =
# base deps
{[base]deps}
# azure-cli deps
azure-cli
setenv =
PYTHONPATH={envsitepackagesdir}/azure-cli-extensions/azure-iot-ops
commands =
python --version
# install to tox extension dir
pip install -U --target {envsitepackagesdir}/azure-cli-extensions/azure-iot-ops .
# validate az and extension version
az -v
pytest -k _unit ./azext_edge/tests --cov=azext_edge/edge --cov-config .coveragerc --junitxml=junit/test-aziotops-ext-unit.xml {posargs}
# You can pass additional positional args to pytest using `tox -e [env] -- -s -vv`
# integration tests
[testenv:python-{init,e2e,rpsaas,wlif,edge,all}-int]
skip_install = True
description =
{[base]description}
init: ops init / create
wlif: workload identity setup required
e2e: only e2e pipeline
rpsaas: only rpsaas
edge: all non-rpsaas
all: all non-init
int: integration tests
deps =
# base deps
{[testenv:python]deps}
pytest-randomly # for pytest-randomly to distribute tests correctly to pytest-xdist
passenv =
# pass all env vars with this prefix to tox
azext_edge_*
setenv =
# You can temporarily add variables here to modify your tests
# azext_edge_skip_init=true
PYTHONPATH={envsitepackagesdir}/azure-cli-extensions/azure-iot-ops
init: SCENARIO="init_scenario_test"
e2e: SCENARIO="e2e"
rpsaas: SCENARIO="rpsaas"
wlif: SCENARIO="require_wlif_setup"
edge: SCENARIO="not rpsaas and not init_scenario_test"
all: SCENARIO="not init_scenario_test and not require_wlif_setup"
commands =
python --version
# install to tox extension dir
pip install -U --target {envsitepackagesdir}/azure-cli-extensions/azure-iot-ops .
# validate az and extension version
az -v
# run tests (do not reorder execution with randomly)
pytest --randomly-dont-reorganize -vv -k "_int.py" -m {env:SCENARIO:all} ./azext_edge/tests --cov --cov-config .coveragerc --cov-report=json --cov-report=term:skip-covered --junitxml=junit/JUnit.xml {posargs}
# You can pass additional positional args to pytest using `tox -e [env] -- -s -vv`
# code coverage - HTML and JSON
[testenv:coverage]
description = run code coverage
deps =
{[testenv:python]deps}
commands =
# build json, html, and terminal reports - skip fully covered files
pytest -k _unit --cov --cov-config .coveragerc --cov-report=json --cov-report=html --cov-report=term:skip-covered ./azext_edge/tests