@@ -189,23 +189,50 @@ by using the ``tox:jenkins`` section:
189
189
commands = ... # override settings for the jenkins context
190
190
191
191
192
- tox environment settings
193
- ------------------------
192
+ tox environments
193
+ ----------------
194
194
195
- Test environments are defined by a:
195
+ Test environments are defined under the ``testenv `` section and individual
196
+ ``testenv:NAME `` sections, where ``NAME `` is the name of a specific
197
+ environment.
196
198
197
199
.. code-block :: ini
198
200
201
+ [testenv]
202
+ commands = ...
203
+
199
204
[testenv:NAME]
200
205
commands = ...
201
206
202
- section. The ``NAME `` will be the name of the virtual environment.
203
- Defaults for each setting in this section are looked up in the::
207
+ Settings defined in the top-level ``testenv `` section are automatically
208
+ inherited by individual environments unless overridden. Test environment names
209
+ can consist of alphanumeric characters and dashes; for example:
210
+ ``py38-django30 ``. The name will be split on dashes into multiple factors,
211
+ meaning ``py38-django30 `` will be split into two factors: ``py38 `` and
212
+ ``django30 ``. *tox * defines a number of default factors, which correspond to
213
+ various versions and implementations of Python and provide default values for
214
+ :conf: `basepython `:
215
+
216
+ - ``pyNM ``: configures ``basepython = pythonN.M ``
217
+ - ``pyN ``: configures ``basepython = pythonN ``
218
+ - ``py ``: configures ``basepython = python ``
219
+ - ``pypyN ``: configures ``basepython = pypyN ``
220
+ - ``pypy ``: configures ``basepython = pypy ``
221
+ - ``jythonN ``: configures ``basepython = jythonN ``
222
+ - ``jython ``: configures ``basepython = jython ``
223
+
224
+ It is also possible to define what's know as *generative names *, where an
225
+ individual section maps to multiple environments; for example:
226
+ ``py{37,38}-django{30,31} ``, which would generate four environments, each
227
+ consisting of two factors a piece: ``py37-django30 `` (``py37 ``, ``django30 ``),
228
+ ``py37-django31 `` (``py37 ``, ``django31 ``), ``py38-django30 `` (``py38 ``,
229
+ ``django30 ``), and ``py38-django31 `` (``py38 ``, ``django31 ``). Combined, these
230
+ features provide the ability to write very concise ``tox.ini `` files and is
231
+ discussed further `below <generating-environments >`__.
204
232
205
- [testenv]
206
- commands = ...
207
233
208
- ``testenv `` default section.
234
+ tox environment settings
235
+ ------------------------
209
236
210
237
Complete list of settings that you can put into ``testenv* `` sections:
211
238
@@ -755,6 +782,8 @@ You can put default values in one section and reference them in others to avoid
755
782
{[base]deps}
756
783
757
784
785
+ .. _generating-environments :
786
+
758
787
Generating environments, conditional settings
759
788
---------------------------------------------
760
789
@@ -793,7 +822,7 @@ Let's go through this step by step.
793
822
.. _generative-envlist :
794
823
795
824
Generative envlist
796
- +++++++++++++++++++++++
825
+ ++++++++++++++++++
797
826
798
827
::
799
828
@@ -856,9 +885,10 @@ but still want to take advantage of factor-conditional settings.
856
885
Factors and factor-conditional settings
857
886
++++++++++++++++++++++++++++++++++++++++
858
887
859
- Parts of an environment name delimited by hyphens are called factors and can
860
- be used to set values conditionally. In list settings such as ``deps `` or
861
- ``commands `` you can freely intermix optional lines with unconditional ones:
888
+ As discussed previously, parts of an environment name delimited by hyphens are
889
+ called factors and can be used to set values conditionally. In list settings
890
+ such as ``deps `` or ``commands `` you can freely intermix optional lines with
891
+ unconditional ones:
862
892
863
893
.. code-block :: ini
864
894
@@ -908,6 +938,7 @@ special case for a combination of factors. Here is how you do it:
908
938
py{27,36}-sqlite: mock # mocking sqlite in python 2.x & 3.6
909
939
!py34-sqlite: mock # mocking sqlite, except in python 3.4
910
940
sqlite-!py34: mock # (same as the line above)
941
+ !py34,!py36: enum34 # use if neither py34 nor py36 are in the env name
911
942
912
943
Take a look at the first ``deps `` line. It shows how you can special case
913
944
something for a combination of factors, by just hyphenating the combining
0 commit comments