tox-recreate-hook¶
(experimental) Allows hooks to be defined which are called when recreating a tox testenv.
Installation¶
python3 -m pip install tox-recreate-hook --user
python3 -m pip install git+https://github.com/python-coincidence/tox-recreate-hook@master --user
Contents¶
Usage¶
tox-recreate-hook
is configured using the recreate_hook
key in the testenv
sections of tox.ini
.
The configuration might look like:
[tox]
envlist = py37, py38, py39, mypy, docs
skip_missing_interpreters = True
isolated_build = True
requires =
pip>=21
tox-recreate-hook
[testenv:docs]
changedir = {toxinidir}/doc-source
deps = -r{toxinidir}/doc-source/requirements.txt
commands = sphinx-build -M html . ./build {posargs}
recreate_hook = builtin.rmdir("{toxinidir}/doc-source/build")
recreate_hook
can be any valid single-line Python expression, the result of which will be printed to the terminal. tox-recreate-hook
ships with several hooks in the builtin
module. Hooks can also be defined in custom modules, either on the PYTHONPATH
or in toxinidir
.
Built In Hooks¶
|
Remove the given directory and its contents. |
-
rmdir
(path)[source]¶ Remove the given directory and its contents.
- Parameters
- Return type
- Returns
A message in the format
'removing <path>'
Attention
On Windows-like systems using
\
as a path separator you may need to use a raw string for the path as thetoxinidir
substitution may contain backslashes:recreate_hook = builtin.rmdir(r"{toxinidir}/doc-source/build")
Downloading source code¶
The tox-recreate-hook
source code is available on GitHub,
and can be accessed from the following URL: https://github.com/python-coincidence/tox-recreate-hook
If you have git
installed, you can clone the repository with the following command:
git clone https://github.com/python-coincidence/tox-recreate-hook
Cloning into 'tox-recreate-hook'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.

Downloading a ‘zip’ file of the source code¶
Building from source¶
The recommended way to build tox-recreate-hook
is to use tox:
tox -e build
The source and wheel distributions will be in the directory dist
.
If you wish, you may also use pep517.build or another PEP 517-compatible build tool.
View the Function Index or browse the Source Code.