-
Notifications
You must be signed in to change notification settings - Fork 66
/
tox.ini
160 lines (147 loc) · 5.61 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# 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]
skip_missing_interpreters = true
envlist =
lint
python-azcur-unit
[base]
distdir={toxworkdir}/build
deps =
-r dev_requirements
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
# az{x} determines:
# {min} - minimum supported azure-cli
# {cur} - latest released azure-cli
# {dev} - installs azure-cli from ../azure-cli
# int/unit determines test suites to run
# 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
py311: Python 3.12
azmin: min azure-cli
azcur: current azure-cli
azdev: dev azure-cli
int: Integration Tests
unit: Unit Tests
[testenv:lint]
description = run linter
deps =
{[base]deps}
azure-cli
commands =
flake8 azext_iot/ --statistics --config=setup.cfg
pylint azext_iot/ --rcfile=.pylintrc
[testenv:py{thon,38,39,310,311,312}-az{min,cur,dev}-{int,unit}]
skip_install = True
description =
{[base]description}
setenv =
azext_iot_testrg=testrg
PYTHONPATH={envsitepackagesdir}/azure-cli-extensions/azure-iot
passenv =
azext_*
deps =
# base deps
{[base]deps}
# azure-cli deps
azmin: azure-cli==2.46.0
azcur: azure-cli
azdev: ../azure-cli/src/azure-cli
azdev: ../azure-cli/src/azure-cli-core
# azure cli test sdk
azure-cli-testsdk
commands =
python --version
# install to tox extension dir
pip install -U --target {envsitepackagesdir}/azure-cli-extensions/azure-iot .
# validate az and extension version
az -v
# run tests
# You can pass additional positional args to pytest using `-- {args}`
unit: pytest -k _unit.py ./azext_iot/tests {posargs}
int: pytest -k _int.py ./azext_iot/tests {posargs}
# tox-gh matrix (github action -> tox python environment)
[gh]
python =
3.12 = py312-azcur-unit
3.11 = py311-azcur-unit
3.10 = py310-azcur-unit
3.9 = py39-azcur-unit
3.8 = lint, py38-azmin-unit
# tests to be run in integration pipeline
[testenv:{Central,ADT,DPS,Hub1,Hub2,ADU}-int]
skip_install = True
passenv =
AZURE_*
azext_*
description =
Central: IoT Central
ADT: Digital Twin
DPS: DPS
Hub1: IoT Hub certificate, config, core, jobs, state
Hub2: IoT Hub devices, message endpoints, messaging, and modules
ADU: ADU
{[base]description}
deps =
# base deps
{[base]deps}
azure-cli==2.58.0
# azure cli test sdk
azure-cli-testsdk
setenv =
AZURE_TEST_RUN_LIVE=True
PYTHONPATH={envsitepackagesdir}/azure-cli-extensions/azure-iot
commands =
python --version
# install to tox extension dir
pip install -U --target {envsitepackagesdir}/azure-cli-extensions/azure-iot .
# validate az and extension version
az -v
# run tests
# You can pass additional positional args to pytest using `-- {args}`
Central: pytest -vv -k _int.py ./azext_iot/tests/central \
Central: --dist=loadfile -n 7 --reruns 2 --reruns-delay 60 \
Central: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml {posargs}
ADT: pytest -vv -k _int.py ./azext_iot/tests/digitaltwins \
ADT: --dist=loadfile -n 7 --reruns 2 --reruns-delay 60 \
ADT: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml {posargs}
DPS: pytest -vv -k _int.py ./azext_iot/tests/dps --dist=loadfile \
DPS: -n 7 --reruns 2 --reruns-delay 60 \
DPS: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml {posargs}
Hub1: pytest -vv -k _int.py ./azext_iot/tests/iothub/certificate ./azext_iot/tests/iothub/configurations \
Hub1: ./azext_iot/tests/iothub/core ./azext_iot/tests/iothub/jobs ./azext_iot/tests/iothub/state/ \
Hub1: --dist=loadfile -n 7 --reruns 2 --reruns-delay 60 \
Hub1: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml \
Hub1: --deselect=azext_iot/tests/iothub/core/test_iothub_discovery_int.py::TestIoTHubDiscovery::test_iothub_targets \
Hub1: --durations=0 {posargs}
Hub2: pytest -vv -k _int.py ./azext_iot/tests/iothub/devices ./azext_iot/tests/iothub/messaging \
Hub2: ./azext_iot/tests/iothub/modules ./azext_iot/tests/iothub/message_endpoint \
Hub2: --dist=loadfile -n 7 --reruns 2 --reruns-delay 60 \
Hub2: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml \
Hub2: --deselect=azext_iot/tests/iothub/core/test_iothub_discovery_int.py::TestIoTHubDiscovery::test_iothub_targets \
Hub2: --durations=0 {posargs}
ADU: pytest -vv -k _int.py ./azext_iot/tests/deviceupdate \
ADU: --dist=loadfile -n 7 --reruns 0 --reruns-delay 60 \
ADU: --cov=azext_iot --cov-config .coveragerc --junitxml=junit/test-iotext-int.xml {posargs}
[testenv:coverage]
description = run code coverage
setenv =
azext_iot_testrg=testrg
PYTHONPATH={envsitepackagesdir}/azure-cli-extensions/azure-iot
deps =
{[base]deps}
azure-cli
azure-cli-testsdk
commands =
# install to tox extension dir due to issue loading azext_iot/tests/deviceupdate/test_adu_loader_int.py
pip install -U --target {envsitepackagesdir}/azure-cli-extensions/azure-iot .
pytest -k _unit.py --cov=azext_iot --cov-report=json --cov-report=html ./azext_iot/tests