# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
isolated_build = True
skip_missing_interpreters = True
envlist =
	py3
	py36
	platformdirs
	xdgappdirs

[testenv]
deps =
	# libraries required by examples
	urwid
	{mypy,py3,cov,expcov}: prompt_toolkit
	# test tools
	pudb
	pytest
	{py3,mypy}: mypy>=1.3.0
	{py3,mypy}: types-appdirs
commands =
	py3: mypy
	pytest {posargs}

[testenv:{platformdirs,xdgappdirs}]
deps =
	platformdirs: platformdirs
	xdgappdirs: xdgappdirs
	pytest
commands =
	pytest tests/test_appdirs.py {posargs}

[testenv:cov]
deps =
	{[testenv]deps}
	pytest-cov
allowlist_externals =
	rm
commands =
	rm -rf htmlcov/
	pytest --cov=confattr --cov-report=html --cov-branch --cov-fail-under=100 {posargs}

[testenv:expcov]
deps =
	{[testenv]deps}
	coverage
commands =
	coverage erase
	coverage run -m pytest {posargs}
	coverage html --fail-under=100 --include='docs/source/examples/*' --omit='*/test_*,*/__init__.py'

[testenv:mypy]
deps =
	{[testenv]deps}
commands =
	mypy
