pytest provides session scoped fixtures, making it much easier to reuse resources across tests.
91 lines
2.0 KiB
INI
91 lines
2.0 KiB
INI
# Copyright 2026 Cloudbase Solutions Srl
|
|
# All Rights Reserved.
|
|
|
|
[tox]
|
|
minversion = 4.0.2
|
|
envlist = fmt,flake8,mypy,pep8,py3
|
|
skipsdist = True
|
|
|
|
[vars]
|
|
src_path = {toxinidir}/openvixdisklib
|
|
tst_path = {toxinidir}/tests
|
|
all_path = {[vars]src_path} {[vars]tst_path}
|
|
vddk_path = {toxinidir}/.vddk
|
|
|
|
[testenv]
|
|
sitepackages = True
|
|
usedevelop = True
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
deps =
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
allowlist_externals =
|
|
bash
|
|
|
|
[testenv:integration]
|
|
description = Run integration tests against a VMware environment.
|
|
sitepackages = True
|
|
usedevelop = True
|
|
setenv =
|
|
{[testenv]setenv}
|
|
LD_LIBRARY_PATH={[vars]vddk_path}
|
|
LD_PRELOAD=
|
|
commands =
|
|
python -m pytest -v tests/integration/ {posargs}
|
|
|
|
[testenv:integration-coverage]
|
|
description = Integration tests with coverage report.
|
|
sitepackages = True
|
|
usedevelop = True
|
|
setenv =
|
|
{[testenv:integration]setenv}
|
|
deps =
|
|
{[testenv]deps}
|
|
pytest-cov
|
|
pycobertura
|
|
commands =
|
|
python -m pytest --cov=openvixdisklib --cov-report=term-missing \
|
|
--cov-report=xml -p no:cacheprovider tests/integration/ {posargs}
|
|
pycobertura show --format html --source openvixdisklib \
|
|
coverage.xml -o coverage.html
|
|
|
|
[testenv:fmt]
|
|
description = Format the code based on the coding style standards.
|
|
deps =
|
|
ruff
|
|
commands =
|
|
ruff check --select I --fix {[vars]all_path}
|
|
ruff format {[vars]all_path}
|
|
|
|
[testenv:pep8]
|
|
description = Verify the coding style (pep8).
|
|
deps =
|
|
ruff
|
|
commands =
|
|
ruff format --diff {[vars]all_path}
|
|
ruff check {[vars]all_path}
|
|
|
|
[testenv:mypy]
|
|
description = Type checks (mypy).
|
|
deps =
|
|
mypy
|
|
pytest
|
|
commands =
|
|
mypy {[vars]all_path}
|
|
|
|
[testenv:flake8]
|
|
sitepackages = True
|
|
deps =
|
|
flake8
|
|
commands = flake8 {posargs}
|
|
allowlist_externals =
|
|
flake8
|
|
|
|
[flake8]
|
|
ignore = E125,E251,W503,W504,E305,E731,E117,W605,F632
|
|
exclude = .venv,.git,.tox,dist,build,*.egg
|
|
# Same length as ruff.
|
|
max-line-length = 88
|