Skip to content

Commit

Permalink
improve documentation on auto-provision
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Mar 12, 2019
1 parent 5947aa2 commit 8d29d93
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
8 changes: 2 additions & 6 deletions docs/changelog/998.feature.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
Auto provision host tox requirements. In case the host tox does not satisfy either the
:conf:`minversion` or the :conf:`requires`, tox will now automatically create a virtual environment
under :conf:`provision_tox_env` that satisfies those constraints and delegate all calls to this
meta environment. This should allow automatically satisfying constraints on your tox environment,
given you have at least version ``3.8.0`` of tox. Plugins no longer need to be manually satisfied
by the users, increasing their ease of use.
tox now auto-provisions itself if needed (see :ref:`auto-provision`). Plugins or minimum version of tox no longer
need to be manually satisfied by the user, increasing their ease of use.
2 changes: 2 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Complete list of settings that you can put into ``testenv*`` sections:
Use this to specify the python version for a tox environment. If not specified, the virtual
environments factors (e.g. name part) will be used to automatically set one. For example, ``py37``
means ``python3.7``, ``py3`` means ``python3`` and ``py`` means ``python``.
:conf:`provision_tox_env` environment does not inherit this setting from the ``toxenv`` section.

.. versionchanged:: 3.1

Expand All @@ -233,6 +234,7 @@ Complete list of settings that you can put into ``testenv*`` sections:
:conf:`ignore_basepython_conflict` is set, the value is ignored and we force the
``basepython`` implied from the factor name.


.. conf:: commands ^ ARGVLIST

The commands to be called for testing. Only execute if :conf:`commands_pre` succeed.
Expand Down
26 changes: 26 additions & 0 deletions docs/example/basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,29 @@ Example progress bar, showing a rotating spinner, the number of environments run
.. code-block:: bash
⠹ [2] py27 | py36
.. _`auto-provision`:

tox auto-provisioning
---------------------
In case the host tox does not satisfy either the :conf:`minversion` or the :conf:`requires`, tox will now automatically
create a virtual environment under :conf:`provision_tox_env` that satisfies those constraints and delegate all calls
to this meta environment. This should allow automatically satisfying constraints on your tox environment,
given you have at least version ``3.8.0`` of tox.

For example given:

.. code-block:: ini
[tox]
minversion = 3.10.0
requires = tox_venv >= 1.0.0
if the user runs it with tox ``3.8.0`` or later installed tox will automatically ensured that both the minimum version
and requires constraints are satisfied, by creating a virtual environment under ``.tox`` folder, and then installing
into it ``tox >= 3.10.0`` and ``tox_venv >= 1.0.0``. Afterwards all tox invocations are forwarded to the tox installed
inside ``.tox\.tox`` folder (referred to as meta-tox or auto-provisioned tox).

This allows tox to automatically setup itself with all its plugins for the current project. If the host tox satisfies
the constraints expressed with the :conf:`requires` and :conf:`minversion` no such provisioning is done (to avoid
setup cost when it's not explicitly needed).
2 changes: 1 addition & 1 deletion tests/unit/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_all_rst_ini_blocks_parse(filename, tmpdir):
try:
parseconfig(["-c", str(config_path)])
except tox.exception.MissingRequirement:
assert "requires = tox-venv" in str(code)
pass
except Exception as e:
raise AssertionError(
"Error parsing ini block\n\n"
Expand Down

0 comments on commit 8d29d93

Please sign in to comment.