summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/tox.ini
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/pybind/mgr/tox.ini140
1 files changed, 140 insertions, 0 deletions
diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini
new file mode 100644
index 000000000..c97992113
--- /dev/null
+++ b/src/pybind/mgr/tox.ini
@@ -0,0 +1,140 @@
+[tox]
+envlist =
+ py3,
+ py37,
+ lint,
+ mypy,
+ test,
+ fix
+ flake8
+ jinjalint
+skipsdist = true
+
+[pytest]
+log_level=NOTSET
+
+[base]
+deps =
+ -rrequirements.txt
+
+[pylint]
+# Allow similarity/code duplication detection
+jobs = 1
+addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs}
+
+[flake8]
+max-line-length = 100
+ignore =
+ E501,
+ W503,
+exclude =
+ .tox \
+ .vagrant \
+ __pycache__ \
+ *.pyc \
+ templates \
+ .eggs
+statistics = True
+
+[autopep8]
+addopts =
+ --max-line-length {[flake8]max-line-length} \
+ --exclude "{[flake8]exclude}" \
+ --in-place \
+ --recursive \
+ --ignore-local-config
+
+[testenv]
+setenv =
+ UNITTEST = true
+ PYTHONPATH = $PYTHONPATH:..
+deps =
+ -rrequirements.txt
+commands =
+ pytest --doctest-modules {posargs: \
+ mgr_util.py \
+ tests/ \
+ cephadm/ \
+ mds_autoscaler/ \
+ nfs/ \
+ orchestrator/ \
+ insights/ \
+ pg_autoscaler/ \
+ progress/ \
+ snap_schedule}
+
+[testenv:mypy]
+setenv =
+ MYPYPATH = {toxinidir}/..
+passenv =
+ MYPYPATH
+basepython = python3
+deps =
+ -rrequirements.txt
+ mypy==0.790
+commands =
+ mypy --config-file=../../mypy.ini \
+ -m cephadm \
+ -m dashboard \
+ -m devicehealth \
+ -m mds_autoscaler \
+ -m mgr_module \
+ -m mgr_util \
+ -m mirroring \
+ -m nfs \
+ -m orchestrator \
+ -m pg_autoscaler \
+ -m progress \
+ -m prometheus \
+ -m rook \
+ -m snap_schedule \
+ -m stats \
+ -m test_orchestrator \
+ -m volumes
+
+[testenv:test]
+setenv = {[testenv]setenv}
+deps = {[testenv]deps}
+commands = {[testenv]commands}
+
+[testenv:fix]
+basepython = python3
+deps =
+ autopep8
+ cli_api
+commands =
+ python --version
+ autopep8 {[autopep8]addopts} {posargs: \
+ cephadm/ orchestrator/ nfs/}
+
+[testenv:pylint]
+basepython = python3
+deps =
+ pylint
+modules =
+ cli_api
+commands =
+ pylint {[pylint]addopts} {posargs:{[testenv:pylint]modules}}
+
+[testenv:flake8]
+basepython = python3
+deps =
+ flake8
+allowlist_externals = bash
+modules =
+ cephadm \
+ cli_api \
+ nfs \
+ orchestrator \
+ prometheus
+commands =
+ flake8 --config=tox.ini {posargs} \
+ {posargs:{[testenv:flake8]modules}}
+ bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "docker.io" | wc -l) == 13'
+
+[testenv:jinjalint]
+basepython = python3
+deps =
+ jinjaninja
+commands =
+ jinja-ninja cephadm/templates