-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtox.ini
More file actions
122 lines (115 loc) · 3.59 KB
/
tox.ini
File metadata and controls
122 lines (115 loc) · 3.59 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
114
115
116
117
118
119
120
121
122
# 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 =
clean
lint
python
report
# 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
py310: Python 3.10
py311: Python 3.11
py312: Python 3.12
py313: Python 3.13
# 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,39,310,311,312,313}]
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.py" ./azext_edge/tests \
--cov=azext_edge/edge --cov-config .coveragerc --cov-append --cov-report term:skip-covered \
--junitxml=junit/test-aziotops-ext-unit.xml {posargs}
# integration tests
[testenv:python-{init,e2e,rpsaas,upgrade,long,wlif,edge,all}-int]
skip_install = True
description =
{[base]description}
init: ops init / create
wlif: marked workload identity
e2e: marked e2e pipeline
rpsaas: marked cloud
upgrade: marked upgrade
long: marked long-running
edge: non-marked (default)
all: all (except init, wlif)
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 and not long_running"
long: SCENARIO="long_running"
wlif: SCENARIO="require_wlif_setup"
edge: SCENARIO="edge"
upgrade: SCENARIO="upgrade"
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} ./azext_edge/tests \
--cov=azext_edge/edge --cov-config .coveragerc --cov-append --cov-report term:skip-covered \
--durations 0 --junitxml=junit/JUnit.xml {posargs}
# code coverage
[testenv:report]
deps = coverage
allowlist_externals = coverage
skip_install = true
commands =
coverage report
coverage html
coverage json
# clean up code coverage
[testenv:clean]
deps = coverage
allowlist_externals = coverage
skip_install = true
commands = coverage erase