Right now the tools directory is not checked by pylint because it will not auto-detect what files are python files and instead just skip the dir if it does not have a __init__.py. This commit uses `tox-backticks` to run a custom find to ensure the python files are explicitely added. I'm not sure we can use tox-backticks or we need it packages for fedora/rhel? If we cannot use it we need to look into either a custom tox plugin to support more rich globbing or just move out `tools/set-env-variables.sh` as it's the only non-python code in the repo and it will trip up pylint (syntax error).
82 lines
1.6 KiB
INI
82 lines
1.6 KiB
INI
[tox]
|
|
env_list =
|
|
py{36,37,38,39,310,311}
|
|
lint
|
|
type
|
|
|
|
labels =
|
|
test = py{36,37,38,39,310,311}
|
|
lint = ruff, isort, autopep8, pylint
|
|
type = mypy,mypy-strict
|
|
|
|
[testenv]
|
|
description = "run osbuild unit tests"
|
|
deps =
|
|
pytest
|
|
pytest-xdist
|
|
jsonschema
|
|
mako
|
|
iniparse
|
|
pyyaml
|
|
toml
|
|
pykickstart
|
|
# required by pykickstart but not pulled in automatically :/
|
|
requests
|
|
tox-backticks
|
|
|
|
setenv =
|
|
LINTABLES = osbuild/ assemblers/* devices/* inputs/* mounts/* runners/* sources/* stages/*.* stages/test/*.py test/ `find ./tools ! -name "*.sh" -type f`
|
|
TYPEABLES = osbuild
|
|
TYPEABLES_STRICT = ./osbuild/main_cli.py
|
|
|
|
passenv =
|
|
TEST_CATEGORY
|
|
|
|
commands =
|
|
bash -c 'python -m pytest --pyargs --rootdir=. {env:TEST_CATEGORY} {env:TEST_WORKERS}'
|
|
|
|
allowlist_externals =
|
|
bash
|
|
|
|
[testenv:ruff]
|
|
deps =
|
|
ruff==0.0.263
|
|
|
|
commands =
|
|
bash -c 'python -m ruff {env:LINTABLES}'
|
|
|
|
[testenv:isort]
|
|
deps =
|
|
isort==5.12.0
|
|
|
|
commands =
|
|
bash -c 'python -m isort --check --diff {env:LINTABLES}'
|
|
|
|
[testenv:autopep8]
|
|
deps =
|
|
autopep8==2.0.2
|
|
pycodestyle==2.10.0
|
|
|
|
commands =
|
|
bash -c 'python -m autopep8 --diff --max-line-length 120 -a -a -a -j0 -r --exit-code {env:LINTABLES}'
|
|
|
|
[testenv:pylint]
|
|
deps =
|
|
pylint==3.0.2
|
|
|
|
commands =
|
|
bash -c 'python -m pylint {env:LINTABLES}'
|
|
|
|
[testenv:mypy]
|
|
deps =
|
|
mypy==1.2.0
|
|
|
|
commands =
|
|
bash -c 'python -m mypy {env:TYPEABLES}'
|
|
|
|
[testenv:mypy-strict]
|
|
deps =
|
|
mypy==1.2.0
|
|
|
|
commands =
|
|
bash -c 'python -m mypy --follow-imports=skip --disallow-untyped-calls --disallow-untyped-defs --disallow-incomplete-defs {env:TYPEABLES_STRICT}'
|