[tox] envlist = py3, lint, fix, check, run, openapi-{check, fix, doc} skipsdist = true minversion = 2.9.1 [pytest] addopts = --cov --cov-append --cov-report=term --doctest-modules --ignore=frontend/ --ignore=module.py --instafail [base] deps = -rrequirements.txt -cconstraints.txt [base-test] deps = -rrequirements-test.txt [base-lint] deps = -rrequirements-lint.txt [testenv] basepython=python3 deps = {[base]deps} {[base-test]deps} -rrequirements-extra.txt passenv = PYTHONPATH setenv = PYTHONPATH=$PYTHONPATH:../.. CFLAGS = -DXMLSEC_NO_SIZE_T PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 UNITTEST = true WEBTEST_INTERACTIVE = false commands = pytest {posargs} [testenv:run] deps = {[base]deps} {[base-test]deps} {[base-lint]deps} allowlist_externals = * commands = {posargs} [flake8] max-line-length = 100 ignore = E226 E402 W503 F812 exclude = .tox, .git, __pycache__, build, dist, *.egg-info, .cache, *.pyc, .eggs, venv, frontend, statistics = True #TODO: Uncomment and refactor (https://tracker.ceph.com/issues/41221) #max-complexity = 10 format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s [isort] atomic = true multi_line_output = 2 line_length = 100 wrap_length = 80 [pylint] # Allow similarity/code duplication detection jobs = 1 dirs = . api controllers plugins services tests ../../../../qa/tasks/mgr/dashboard addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs} [rstlint] dirs = README.rst HACKING.rst [base-pylint] commands = pylint {[pylint]addopts} {[pylint]dirs} [base-rst] commands = rstcheck --report info --debug -- {[rstlint]dirs} [testenv:lint] deps = {[base]deps} {[base-lint]deps} commands = flake8 flake8 --config=tox.ini ../../../../qa/tasks/mgr/dashboard isort . --check isort ../../../../qa/tasks/mgr/dashboard --check {[base-pylint]commands} {[base-rst]commands} [testenv:flake8] deps = {[base-lint]deps} commands = flake8 --config=tox.ini {posargs} [testenv:pylint] deps = {[base]deps} {[base-lint]deps} commands = pylint {[pylint]addopts} {posargs:{[pylint]dirs}} [testenv:rst] deps = {[base-lint]deps} commands = rstcheck --report info --debug -- {posargs:{[rstlint]dirs}} [autopep8] addopts = --max-line-length {[flake8]max-line-length} --exclude "{[flake8]exclude}" --in-place --recursive # TODO: we should progressively increase the level of compliance with PEP8 # --aggressive # --aggressive [testenv:fix] deps = {[base-lint]deps} commands = python --version autopep8 {[autopep8]addopts} {posargs:.} isort . isort ../../../../qa/tasks/mgr/dashboard [testenv:check] commands = python ci/check_grafana_dashboards.py frontend/src/app ../../../../monitoring/ceph-mixin/dashboards_out [testenv:openapi-{check,fix}] allowlist_externals = diff description = check: Ensure that auto-generated OpenAPI Specification matches the current version fix: Update auto-generated OpenAPI Specification with the latest changes deps = {[base]deps} {[base-test]deps} passenv = PYTHONPATH setenv = UNITTEST = true PYTHONPATH=$PYTHONPATH:..:../.. OPENAPI_FILE=openapi.yaml check: OPENAPI_FILE_TMP={envtmpdir}/{env:OPENAPI_FILE} commands = python3 -m dashboard.controllers.docs {env:OPENAPI_FILE_TMP:{env:OPENAPI_FILE}} check: diff {env:OPENAPI_FILE} {env:OPENAPI_FILE_TMP} [testenv:openapi-doc] description = Generate Sphinx documentation from OpenAPI specification deps = -r../../../../admin/doc-requirements.txt changedir = ../../../../doc commands = sphinx-build -W -b html -c . -D suppress_warnings=ref.* -d {envtmpdir}/doctrees mgr/ceph_api {envtmpdir}/html