1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
[tox]
minversion = 3.24.4
envlist = lint,py,docs,packaging
isolated_build = True
[testenv]
deps =
-r{toxinidir}/test-requirements.txt
commands = pytest {posargs}
whitelist_externals =
rm
sh
setenv =
PIP_DISABLE_PIP_VERSION_CHECK=1
[testenv:lint]
deps =
pre-commit
commands =
pre-commit run -a
[testenv:docs]
deps =
-r{toxinidir}/doc/requirements.txt
commands =
python -m doc8 -e .rst doc CONTRIBUTING.rst README.rst
sphinx-build -W -b html doc/source doc/build/html
[testenv:packaging]
description =
Build package, verify metadata, install package and assert behavior
deps =
build >= 0.7.0, < 0.8.0
twine
usedevelop = false
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check --strict {toxinidir}/dist/*
# Ensure package is not installed
pip uninstall -y doc8
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
doc8 --version
python -m doc8 --version
# Ensure package can be uninstalled
pip uninstall -y doc8
|