1
0
mirror of https://gerrit.ovirt.org/vdsm synced 2026-02-05 12:46:23 +01:00
Files
vdsm/tox.ini
Sandro Bonazzola 992f635a4e reduce W504 issues
reduced W504 issues by covering init, static and vdsm_hooks directories.
Updated statistics.

Change-Id: Iab72f7cb01aae8862cb72e5afa474eed91e4112d
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
2021-12-02 23:04:37 +02:00

233 lines
5.6 KiB
INI

[tox]
envlist = flake8, pylint, tests, storage, lib, network, virt, gluster, hooks
skipsdist = true
skip_missing_interpreters = True
[testenv]
basepython=python3
sitepackages = True
whitelist_externals = profile
[base]
passenv = *
setenv =
PYTHONPATH = {toxinidir}/lib
LC_ALL = C.UTF8
deps =
nose==1.3.7
pytest
pytest-cov
pytest-timeout
changedir = {toxinidir}/tests
markers = "not (integration or slow or stress)"
# PYTHONHASHSEED: Using random hash seed expose bad tests assuming order of
# unorder things.
# TODO: remove this option after the failing tests are fixed.
[testenv:tests]
passenv =
{[base]passenv}
setenv =
{[base]setenv}
PYTHONHASHSEED = 0
deps =
{[base]deps}
yappi
whitelist_externals = make
changedir = {[base]changedir}
commands =
python profile {envname} make check
[testenv:lib]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-lib
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers} --durations=10 {posargs} \
--cov=vdsm \
--cov=yajsonrpc \
--cov-report=html:htmlcov-lib \
common/commands_test.py \
common/concurrent_test.py \
common/properties_test.py \
common/systemctl_test.py \
common/systemd_test.py \
common/time_test.py \
lib/ \
hooking_test.py \
pywatch_test.py \
prlimit_test.py \
ssl_test.py
[testenv:network]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-network
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.network \
--cov-report=html:htmlcov-network \
--cov-fail-under={env:NETWORK_COVERAGE:42} \
{posargs} \
network/integration \
network/unit
[testenv:storage]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-storage
deps = {[base]deps}
changedir = {[base]changedir}
# TODO: Remove --ignore
commands =
python profile {envname} pytest -m {[base]markers} \
--durations=20 \
--cov=vdsm.storage \
--cov-report=html:htmlcov-storage \
--cov-fail-under={env:STORAGE_COVERAGE:68} \
{posargs:storage}
[testenv:virt]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-virt
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.virt \
--cov-report=html:htmlcov-virt \
{posargs:virt}
[testenv:gluster]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-gluster
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.gluster \
--cov-report=html:htmlcov-gluster \
{posargs:gluster}
[testenv:hooks]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-hooks
PYTHONPATH = {toxinidir}/lib:{toxinidir}/lib/vdsm/hook:{toxinidir}/vdsm_hooks
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers} --durations=10 {posargs} \
hooks
[testenv:pylint]
setenv =
PYTHONPATH = vdsm:lib
deps =
pylint~=2.10.0
commands =
python {toxinidir}/tests/profile {envname} pylint -j{env:PYLINT_JOBS:4} --reports=no --score=no {posargs}
[testenv:flake8]
deps =
flake8==3.9.2
commands=
python {toxinidir}/tests/profile {envname} flake8 --statistics {posargs} \
lib \
tests \
vdsm_hooks \
contrib \
build-aux/vercmp \
contrib/logdb \
contrib/logstat \
contrib/lvs-stats \
contrib/profile-stats \
init/daemonAdapter \
lib/vdsm/storage/curl-img-wrap \
lib/vdsm/storage/fc-scan \
static/libexec/vdsm/get-conf-item \
static/usr/bin/vdsm-tool
[testenv:black]
sitepackages = false
skip_install = true
deps =
black==21.6b0
commands =
black \
-l 79 \
-S \
--check \
--diff \
{posargs} \
./lib/vdsm/network/ \
./tests/network
[pytest]
# -r chars: (s)skipped, (x)failed, (X)passed
# --strict-markers: ensure no unregistered markers are used
addopts = -rxXs --basetemp=/var/tmp/vdsm --strict-markers
# Registration of all pytest markers (e.g., pytest.mark.slow)
# https://docs.pytest.org/en/latest/mark.html
markers =
integration
legacy_switch
ovs_switch
root
slow
stress
# Fail if test marks as xfail succeeds. To handle flaky tests You can override
# the value:
# @pytest.mark.xfail(reason="Fails randomly" strict=False)
xfail_strict = True
# Include time with pytest logs for easier identification of related events
log_format=%(asctime)s,%(msecs)03d %(levelname)-7s (%(threadName)s) [%(name)s] %(message)s (%(module)s:%(lineno)d)
log_level=DEBUG
# Kill test process if a test is too slow. Slow tests can override this
# value using:
#
# @pytest.mark.timeout(60)
# def very_slow_test():
#
timeout = 30
# Fail by kiling the test process from another thread.
timeout_method = thread
[flake8]
# Ignore errors in current code to make the build pass
# TODO: fix the code and eliminate these ignores:
# - 18 E731 do not assign a lambda expression, use a def
# - 151 E722 do not use bare 'except'
# - 238 W504 line break after binary operator
#
# The following test must be skipped as this rule goes against the
# PEP 8 recommended style, which was changed on April 16th, 2016:
# - W503 line break before binary operator
ignore = E731, E722, W504, W503
show_source = True