[tox]
envlist = py27-{cov,lint,run,check},py3-{cov,lint,run,check}
skipsdist = true
toxworkdir = {env:CEPH_BUILD_DIR}/dashboard
minversion = 2.8.1

[testenv]
setenv=
    CFLAGS = -DXMLSEC_NO_SIZE_T
    UNITTEST = true
    WEBTEST_INTERACTIVE = false
    LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
    PATH = {toxinidir}/../../../../build/bin:$PATH
    py27: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.2
    py3:  PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3
    cov:  UNITTEST = true
    cov:  COVERAGE_FILE = .coverage.{envname}
commands=
    pip install -r {toxinidir}/requirements.txt
    py27: pip install -r {toxinidir}/requirements-py27.txt
    py3: pip install -r {toxinidir}/requirements-py3.txt
    cov: coverage erase
    cov: {envbindir}/py.test --cov=. --cov-report= --junitxml=junit.{envname}.xml --doctest-modules controllers services/ tests/ tools.py
    cov: coverage combine {toxinidir}/{env:COVERAGE_FILE}
    cov: coverage report
    cov: coverage xml
    lint: pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests services exceptions.py grafana.py ci/check_grafana_uids.py
    lint: pycodestyle --max-line-length=100 --exclude=.tox,venv,frontend,.vscode --ignore=E402,E121,E123,E126,E226,E24,E704,W503,E741 .
    check: python ci/check_grafana_uids.py frontend/src/app ../../../../monitoring/grafana/dashboards
    run: {posargs}
