[tox] package = rstcheck_core minversion = 4 skip_missing_interpreters = true ignore_base_python_conflict = true no_package = false env_list = package pre-commit-run py{312,311,310,39,38} py{312,311,310,39,38}-with-sphinx{5,6,7} py{312,311,310,39,38}-with-tomli coverage-all docs-test-{html,linkcheck,coverage,doctest,spelling} labels = test = py{312,311,310,39,38},py{312,311,310,39,38}-with-yaml,py{312,311,310,39,38}-with-sphinx{5,6,7},py{312,311,310,39,38}-with-tomli,coverage-all py3.8 = py38,py38-with-yaml,py38-with-sphinx{5,6,7},py38-with-tomli,coverage-all py3.9 = py39,py39-with-yaml,py39-with-sphinx{5,6,7},py39-with-tomli,coverage-all py3.10 = py310,py310-with-yaml,py310-with-sphinx{5,6,7},py310-with-tomli,package,coverage-all py3.11 = py311,py311-with-yaml,py311-with-sphinx{5,6,7},py311-with-tomli,package,coverage-all py3.12 = py312,py312-with-yaml,py312-with-sphinx{5,6,7},py312-with-tomli,package,coverage-all docs = docs-test-{html,coverage,doctest} docs-full = docs-test-{html,linkcheck,coverage,doctest,spelling} [testenv] description = basic config env base_python = python3.11 pass_env = HOME CI CI_FORCE_COLORS_PRE_COMMIT CI_FORCE_COLORS_PYTEST CI_FORCE_COLORS_SPHINX set_env = PIP_DISABLE_VERSION_CHECK = 1 download = true commands = echo "Please use available tox envs" exit 1 [testenv:pre-commit] description = format and check the code env_dir = {toxworkdir}/pre-commit pass_env = {[testenv]pass_env} SSH_AUTH_SOCK SKIP set_env = {[testenv]set_env} SKIP = {tty:identity:},{env:SKIP:} skip_install = true deps = pre-commit >= 2.17 commands = pre-commit {posargs:--help} [testenv:pre-commit-run] description = install pre-commit as git hook from the tox env env_dir = {[testenv:pre-commit]env_dir} skip_install = {[testenv:pre-commit]skip_install} deps = {[testenv:pre-commit]deps} commands = pre-commit run {posargs} \ --all-files \ {tty::--show-diff-on-failure} \ {tty:--color always:{env:CI_FORCE_COLORS_PRE_COMMIT:}} [testenv:mypy] description = run mypy type checker extras = toml type_check docs testing ignore_errors = true commands = mypy src/rstcheck_core mypy tests mypy docs/source/conf.py mypy prep_release.py [testenv:pylint] description = run pylint linter deps = pylint >= 2.12 extras = toml docs testing commands = pylint src/rstcheck_core tests docs/source/conf.py prep_release.py [testenv:package] description = check sdist and wheel skip_install = true deps = build >= 1 twine >= 3.3 commands = python -m build twine check --strict dist/* [testenv:py{312,311,310,39,38}] description = run tests with {basepython} pass_env = {[testenv]pass_env} PYTEST_* set_env = {[testenv]set_env} COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}} extras = testing commands = pytest \ {tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \ --basetemp {envtmpdir} \ --cov {envsitepackagesdir}/{[tox]package} \ --cov-fail-under 0 \ {tty::-vvv} \ {posargs:tests} [testenv:py{312,311,310,39,38}-with-yaml] description = run tests with {basepython} pass_env = {[testenv]pass_env} PYTEST_* set_env = {[testenv]set_env} COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}} extras = testing yaml commands = pytest \ {tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \ --basetemp {envtmpdir} \ --cov {envsitepackagesdir}/{[tox]package} \ --cov-fail-under 0 \ {tty::-vvv} \ {posargs:tests} [testenv:py{312,311,310,39,38}-with-sphinx{5,6,7}] description = run tests with {basepython} and sphinx pass_env = {[testenv]pass_env} PYTEST_* set_env = {[testenv]set_env} COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}} extras = testing yaml deps = sphinx5: sphinx>=5,<6 sphinx6: sphinx>=6,<7 sphinx7: sphinx>=7,<8 commands = pytest \ {tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \ --basetemp {envtmpdir} \ --cov {envsitepackagesdir}/{[tox]package} \ --cov-fail-under 0 \ {tty::-vvv} \ {posargs:tests} [testenv:py{312,311,310,39,38}-with-tomli] description = run tests with {basepython} and toml pass_env = {[testenv]pass_env} PYTEST_* set_env = {[testenv]set_env} COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}} extras = testing toml yaml commands = pytest \ {tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \ --basetemp {envtmpdir} \ --cov {envsitepackagesdir}/{[tox]package} \ --cov-fail-under 0 \ {tty::-vvv} \ {posargs:tests} [testenv:coverage-{all,merge,report}] description = all,merge: combine coverage data and create xml/html reports; all,report: report total and diff coverage against origin/main (or DIFF_AGAINST) env_dir = {toxworkdir}/coverage depends = py{py3,312,311,310,39,38} pass_env = {[testenv]pass_env} all,report: MIN_COVERAGE all,report: MIN_DIFF_COVERAGE all,report: DIFF_AGAINST all,report: DIFF_RANGE_NOTATION set_env = {[testenv]set_env} COVERAGE_FILE={toxinidir}/.coverage_cache/.coverage skip_install = true parallel_show_output = true ignore_errors = true deps = diff-cover coverage[toml] >=6.0 coverage-conditional-plugin >=0.5 commands = all,merge: coverage combine all,merge: coverage xml -o {toxinidir}/.coverage_cache/coverage.xml all,merge: coverage html -d {toxinidir}/.coverage_cache/htmlcov all,report: coverage report -m --fail-under {env:MIN_COVERAGE:0} all,report: diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} \ all,report: --ignore-staged --ignore-unstaged \ all,report: --fail-under {env:MIN_DIFF_COVERAGE:0} \ all,report: --diff-range-notation {env:DIFF_RANGE_NOTATION:..} \ all,report: {toxinidir}/.coverage_cache/coverage.xml [testenv:docs{,-auto}] description = build docs with sphinx env_dir = {toxworkdir}/docs set_env = {[testenv]set_env} TOXENV_BUILDCMD = sphinx-build {tty:--color:} auto: TOXENV_BUILDCMD = sphinx-autobuild --re-ignore autoapidoc --watch {toxinidir}/src extras = toml docs commands = # Build fresh docs {env:TOXENV_BUILDCMD} -b html -aE docs/source docs/build/html # Output link to index.html python -c \ 'from pathlib import Path; \ index_file = Path(r"{toxinidir}")/"docs/build/html/index.html"; \ print(f"DOCUMENTATION AVAILABLE UNDER: \{index_file.as_uri()\}")' [testenv:docs-test-{html,linkcheck,coverage,doctest,spelling}] description = Build and check docs with (see env name) sphinx builder env_dir = {[testenv:docs]env_dir} set_env = {[testenv]set_env} html: TOXENV_BUILDER = html linkcheck: TOXENV_BUILDER = linkcheck coverage: TOXENV_BUILDER = coverage doctest: TOXENV_BUILDER = doctest spelling: TOXENV_BUILDER = spelling spelling: SPHINX_SPELLING = true extras = {[testenv:docs]extras} commands = sphinx-build \ {tty:--color:{env:CI_FORCE_COLORS_SPHINX:}} \ -b {env:TOXENV_BUILDER} \ -aE -v -nW --keep-going \ docs/source docs/build/test/{env:TOXENV_BUILDER}