Files
sunbeam-charms/ops-sunbeam/tox.ini
Hemanth Nakkina 5fd9c582e8 Add py311 in tox file
Add py311 in tox file
Remove require virtualenv in tox file.

Change-Id: I3f742784a21fefad581127693e76d2349835d18a
2023-10-20 04:47:04 +05:30

136 lines
3.0 KiB
INI

# Operator charm helper: tox.ini
[tox]
skipsdist = True
envlist = lint, py3
sitepackages = False
skip_missing_interpreters = False
minversion = 3.18.0
[vars]
src_path = {toxinidir}/ops_sunbeam
tst_path = {toxinidir}/tests/unit_tests/
scenario_tst_path = {toxinidir}/tests/scenario_tests/
tst_lib_path = {toxinidir}/tests/lib/
pyproject_toml = {toxinidir}/pyproject.toml
cookie_cutter_path = {toxinidir}/shared_code/sunbeam_charm/\{\{cookiecutter.service_name\}\}
all_path = {[vars]src_path} {[vars]tst_path}
[testenv]
basepython = python3
install_command =
pip install {opts} {packages}
commands =
stestr run --slowest {posargs}
pytest -v --tb native {[vars]scenario_tst_path} --log-cli-level=INFO
allowlist_externals =
git
charmcraft
fetch-libs.sh
deps =
-r{toxinidir}/test-requirements.txt
[testenv:fmt]
description = Apply coding style standards to code
deps =
black
isort
commands =
isort {[vars]all_path} --skip-glob {[vars]tst_lib_path} --skip {toxinidir}/.tox
black --config {[vars]pyproject_toml} {[vars]all_path} --exclude {[vars]tst_lib_path}
[testenv:fetch]
basepython = python3
deps =
commands =
{toxinidir}/fetch-libs.sh
[testenv:cookie]
basepython = python3
deps = -r{toxinidir}/cookie-requirements.txt
commands = /bin/true
[testenv:py3]
basepython = python3
deps =
{[testenv]deps}
-r{toxinidir}/requirements.txt
[testenv:py38]
basepython = python3.8
deps = {[testenv:py3]deps}
[testenv:py39]
basepython = python3.9
deps = {[testenv:py3]deps}
[testenv:py310]
basepython = python3.10
deps = {[testenv:py3]deps}
[testenv:py311]
basepython = python3.11
deps = {[testenv:py3]deps}
[testenv:pep8]
description = Alias for lint
deps = {[testenv:lint]deps}
commands = {[testenv:lint]commands}
[testenv:lint]
description = Check code against coding style standards
deps =
black
flake8<6
flake8-docstrings
flake8-copyright
flake8-builtins
pyproject-flake8
pep8-naming
isort
codespell
commands =
codespell {[vars]all_path}
# pflake8 wrapper supports config from pyproject.toml
pflake8 --exclude {[vars]tst_lib_path} --config {toxinidir}/pyproject.toml {[vars]all_path}
isort --check-only --diff {[vars]all_path} --skip-glob {[vars]tst_lib_path}
black --config {[vars]pyproject_toml} --check --diff {[vars]all_path} --exclude {[vars]tst_lib_path}
[testenv:cover]
basepython = python3
deps = {[testenv:py3]deps}
setenv =
PYTHON=coverage run
commands =
coverage erase
stestr run --slowest {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:scenario]
description = Scenario tests
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
pytest -v --tb native {[vars]scenario_tst_path} --log-cli-level=INFO
[coverage:run]
branch = True
concurrency = multiprocessing
parallel = True
source =
.
omit =
.tox/*
unit_tests/*
[testenv:venv]
basepython = python3
commands = {posargs}
[flake8]
ignore = E226,E402,ANN101,ANN003,W504