[tox] envlist = python minversion = 3.21.0 [testenv] usedevelop = True commands = pytest {posargs} codecov -f coverage.xml -X gcov passenv = WEBTEST_INTERACTIVE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CIRCLECI CIRCLE_* setenv = WEBTEST_INTERACTIVE=false extras = testing routes_dispatcher memcached_session whitelist_externals = mkdir [python-cli-options] byteerrors = -bb bytewarnings = -b # isolate = -I # FIXME: Python 2 shim. Is this equivalent to the above? isolate = -E -s [dists] setenv = PEP517_OUT_DIR = {env:PEP517_OUT_DIR:{toxinidir}{/}dist} [testenv:cheroot-master] deps = git+git://github.com/cherrypy/cheroot.git@master#egg=cheroot [testenv:pre-commit] deps = pre-commit commands = {envpython} -m pre_commit run --show-diff-on-failure {posargs:--all-files} # Print out the advice of how to install pre-commit from this env into Git: -{envpython} -c \ 'cmd = "{envpython} -m pre_commit install"; scr_width = len(cmd) + 10; sep = "=" * scr_width; cmd_str = " $ " + cmd; '\ 'print("\n" + sep + "\nTo install pre-commit hooks into the Git repo, run:\n\n" + cmd_str + "\n\n" + sep + "\n")' [testenv:pre-commit-pep257] deps = pre-commit commands = pre-commit run --config .pre-commit-config-pep257.yaml --all-files {posargs} [testenv:dist-check] # ensure that package artifacts are installed as expected usedevelop = False commands = pytest tests/dist-check.py {posargs} [testenv:setup-check] extras = docs usedevelop = False commands = python -m setup check --metadata --restructuredtext --strict --verbose [testenv:build-docs] basepython = python3 extras = docs testing changedir = docs # FIXME: Add -W option below once this issue is addressed: # https://github.com/jaraco/rst.linker/issues/7 # And once all other warnings are gone. commands = {envpython} -m sphinx \ -a \ -j auto \ -b html \ --color \ -n \ -d "{toxinidir}/build/html_docs_doctree" \ . \ "{toxinidir}/build/html" # Print out the output docs dir and a way to serve html: -{envpython} -c \ 'import pathlib; docs_dir = pathlib.Path(r"{toxinidir}") / "build" / "html"; index_file = docs_dir / "index.html"; '\ 'print("\n" + "=" * 120 + f"\n\nDocumentation available under `file://\{index_file\}`\n\nTo serve docs, use `python3 -m http.server --directory \{docs_dir\} 0`\n\n" + "=" * 120)' [testenv:cleanup-dists] description = Wipe the the dist{/} folder # NOTE: `package_env = none` is needed so it's possible to use `--installpkg` # NOTE: with the main `testenv`. # Ref: https://github.com/tox-dev/tox/issues/2442 package_env = ❌ DUMMY NON-EXISTENT ENV NAME ❌ usedevelop = false skip_install = true deps = setenv = {[dists]setenv} commands_pre = commands = {envpython} \ {[python-cli-options]byteerrors} \ {[python-cli-options]isolate} \ -c \ 'import os, shutil, sys; dists_dir = os.getenv("PEP517_OUT_DIR"); shutil.rmtree(dists_dir, ignore_errors=True); sys.exit(os.path.exists(dists_dir))' [testenv:build-dists] allowlist_externals = env description = Build dists and put them into the `{env:PEP517_OUT_DIR}{/}` folder depends = cleanup-dists platform = darwin|linux # NOTE: The custom command is here to allow resetting the global # NOTE: pip constraints env var. isolated_build = true # NOTE: `package_env = none` is needed so it's possible to use `--installpkg` # NOTE: with the main `testenv`. # Ref: https://github.com/tox-dev/tox/issues/2442 package_env = ❌ DUMMY NON-EXISTENT ENV NAME ❌ # `usedevelop = true` overrides `skip_install` instruction, it's unwanted usedevelop = false skip_install = true deps = -rrequirements{/}tox-build-dists.in passenv = PEP517_BUILD_ARGS setenv = {[dists]setenv} commands_pre = commands = # Starting with build v0.5.0, it builds wheel from sdist # if no format arguments are passed. This makes sure that # wheels are not dependent on the Git repo or anything # external what may be missing from sdist. {envpython} \ {[python-cli-options]byteerrors} \ {[python-cli-options]isolate} \ -m build \ --outdir '{env:PEP517_OUT_DIR}{/}' \ {posargs:{env:PEP517_BUILD_ARGS:}} \ '{toxinidir}'