[tox]
minversion      = 2.4
envlist         = python3, pep8, lint, mypy

[pycodestyle]
max-line-length = 100

[testenv:pep8]
deps            = {[testenv]deps}
                  pycodestyle
commands_pre    = pycodestyle --version
commands        = pycodestyle setools/ setoolsgui/ tests/ tests-gui/ seinfo seinfoflow sedta sesearch sediff sechecker apol --statistics

[testenv:coverage]
#setenv          = SETOOLS_COVERAGE = 1
passenv         = {[testenv]passenv}
deps            = {[testenv]deps}
                  coverage>=6.0
extras          = toml
commands_pre    = coverage --version
                  coverage erase
                  {[testenv]commands_pre}
commands        = coverage run --source=setools,setoolsgui -m pytest tests tests-gui
                  coverage report

[testenv:lint]
passenv         = {[testenv]passenv}
deps            = {[testenv]deps}
                  pylint>=2.8.0
commands_pre    = pylint --version
                  {[testenv]commands_pre}
commands        = pylint -E setools setoolsgui tests tests-gui seinfo seinfoflow sedta sesearch sediff sechecker apol

[testenv:mypy]
deps            = {[testenv]deps}
                  types-setuptools
                  mypy>=1.6.0
commands_pre    = mypy --version
commands        = mypy -p setools -p setoolsgui -p tests -p tests-gui
                  mypy --scripts-are-modules seinfo seinfoflow sedta sesearch sediff sechecker apol

[testenv:install]
deps            = {[testenv]deps}
allowlist_externals = find
commands        = {envpython} -m pip install --use-pep517 --root {envtmpdir}/setools .
                  find {envtmpdir}/setools

[testenv]
passenv         = USERSPACE_SRC
                  DISPLAY
                  XAUTHORITY
deps            = networkx>=2.6
                  cython>=0.29.14
                  pytest>=6.0
                  PyQt6>=6.0
                  pygraphviz
                  pytest-qt
                  pytest-xvfb
commands_pre    = {envpython} setup.py build_ext -i
commands        = {envpython} -m pytest tests tests-gui
