blob: 5348f6b349ba607e5003145a29a944e9b437115b [file] [log] [blame]
[tox]
skipsdist = True
# Adding an environment to this list is not enough to get the tests to be
# executed on-demand by CI. You need to modify rake_modules/taskgen.rb too.
envlist = commit-message, admin, adminschema, py2-pep8, py3-pep8, mtail, nagios_common, grafana, tslua, smart_data_dump, alerts, openstack_puppetenc, wmcs, wmcs-replica_cnf_api_service
[flake8]
max-line-length = 100
ignore =
# Default non-PEP8 ignores
# See <https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes>
E121, E123, E126, E133, E226, E241, E242, E704, W503,
# E402: module level import not at top of file
E402
exclude =
# Do not lint the tox runtime directory
.tox,
# Do not look in the standard ruby bundle directory
.bundle,
# Ignore user dotfiles and scripts
modules/admin/files/home,
# Upstream files that don't pass flake8 but should not be locally modified
modules/jupyterhub/files/jupyterhub_config.py,
modules/jupyterhub/files/nchp_config.py,
modules/letsencrypt/files/acme_tiny.py,
modules/mailman/files/mm_cfg.py,
modules/openstack/files/train/keystone/ldap-common-rocky-fixed.py,
modules/postgresql/files/check_postgres_replication_lag.py,
modules/varnish/files/varnishapi.py,
modules/rabbitmq/files/rabbitmqadmin.py,
# example script that gets vars from environment:
modules/openstack/files/zen/admin_scripts/wmcs-prod-example.sh,
modules/openstack/files/antelope/admin_scripts/wmcs-prod-example.sh,
modules/backy2/files/sql.py,
# needs python3, handled by its own tox.ini
modules/envoyproxy
[testenv]
basepython = python2.7
deps =
pytest
[testenv:admin]
basepython = python3
deps =
{[testenv]deps}
sshpubkeys
PyYAML
commands = pytest modules/admin/data
[testenv:adminschema]
basepython = python3
deps =
{[testenv]deps}
PyYAML
jsonschema
yamllint
commands = python3 ./modules/admin/data/data_validate.py
[testenv:commit-message]
basepython = python3
deps = commit-message-validator>=2.0.0
commands = commit-message-validator validate
[testenv:py2-pep8]
basepython = python2.7
deps = flake8==3.3.0
# add --version as a fallback so `tox -r` runs clean
# ultimately disabling checks, otherwise flake8 will bork on python3 files
commands = flake8 {posargs:{env:TOX_PY2_FILES:--version}}
[testenv:py3-pep8]
basepython = python3
deps = flake8 >=3.3.0
# add --version as a fallback so `tox -r` runs clean
# ultimately disabling checks, otherwise flake8 will bork on python2 files
commands = flake8 {posargs:{env:TOX_PY3_FILES:--version}}
[testenv:mtail]
basepython = python3
commands = pytest modules/mtail/files
[testenv:alerts]
basepython = python3
commands = pytest modules/alerts/files
[testenv:nagios_common]
basepython = python3
commands = pytest modules/nagios_common/files/check_commands
deps =
{[testenv]deps}
requests
prometheus_client
[testenv:grafana]
basepython = python3
# Needed for python3-ldap installed in Docker
# The alternative would be to build python-ldap in the virtualenv, thus requiring headers (e.g. -dev
# packages) in the Docker image anyways.
sitepackages = True
commands = pytest modules/grafana/files
deps =
{[testenv]deps}
wmflib
[testenv:tslua]
basepython = python3
allowlist_externals = /bin/sh
# sh needed to use wildcard
commands = /bin/sh -c 'busted --verbose --helper=modules/profile/files/trafficserver/mock.helper.lua --lpath=modules/profile/files/trafficserver/?.lua ./modules/profile/files/trafficserver/*.lua'
[testenv:smart_data_dump]
basepython = python3
commands = pytest modules/smart/files
deps =
{[testenv]deps}
prometheus_client
[testenv:prometheus]
basepython = python3
commands = pytest modules/prometheus/files
[testenv:openstack_puppetenc]
basepython = python3
commands =
black --check --diff -l 100 -t py39 modules/openstack/files/puppet/master/encapi/
isort --check --diff -l 100 --profile black -t py39 modules/openstack/files/puppet/master/encapi/
deps =
black
isort
[testenv:wmcs]
basepython = python3
commands =
black --check --diff -l 100 -t py39 modules/profile/files/wmcs
isort --check --diff -l 100 --profile black -t py39 modules/profile/files/wmcs
pytest --ignore=modules/profile/files/wmcs/nfs modules/profile/files/wmcs {posargs}
setenv =
PYTHONPATH = modules/openstack/files/clientpackages
deps =
black
isort
ldap3
pymysql
tenacity
# Remove this pin when the CI can run Python 3.9
openstacksdk<1.5.0
python-glanceclient
python-keystoneclient
python-novaclient
python-designateclient
python-cinderclient
python-troveclient
python-neutronclient
{[testenv]deps}
{[testenv:py3-pep8]deps}
# Needed here also as tox does not notice changes in -r included files, fixed in tox 4
toolforge-weld>=1.2.1
[testenv:wmcs-replica_cnf_api_service]
basepython = python3.7
allowlist_externals = {toxinidir}/modules/profile/files/wmcs/nfs/replica_cnf_web_fullstack_tests/run_ci.sh
commands =
flake8 modules/profile/files/wmcs/nfs/replica_cnf_api_service
pytest --disable-warnings modules/profile/files/wmcs/nfs/replica_cnf_api_service {posargs}
{toxinidir}/modules/profile/files/wmcs/nfs/replica_cnf_web_fullstack_tests/run_ci.sh
deps =
{[testenv]deps}
{[testenv:py3-pep8]deps}
-r{toxinidir}/modules/profile/files/wmcs/nfs/replica_cnf_api_service/requirements.txt
# Needed here also as tox does not notice changes in -r included files, fixed in tox 4
toolforge-weld>=1.2.1
bats-core-pkg
requests-mock