Commits

holger krekel committed e29d0f2

simplify variants/combintation explanation doc,
use bash-style substitution for envlist (although it conflicts
with the general {} subsitution which should maybe become ${...}.
IOW, re-use more of bash syntax.

Comments (0)

Files changed (1)

doc/config-v2.txt

   - no way to check if installing via easy_install works
   - no installs of packages with compiled c-extensions (win32 standard)
 
+
 Goals, resolving those issues
 ------------------------------------
 
 - allow platform-specific settings
 - allow to specify platforms against which tests should run
 - allow to run installer-variants (easy_install or pip)
+- try to mimick/re-use bash-style syntax to ease learning curve.
 
  
 Example: Generating and selecting variants
 ----------------------------------------------
  
-Suppose you want to test your package against mypkg-1.3 and mypkg-1.4
-versions, against python2.6, 2.7 interpreters and on ``linux`` and 
-``win32`` platforms.  Today you would have to 
-write down 2*2*2 = 8 ``[testenv*]`` sections and then instruct
+Suppose you want to test your package python2.6, python2.7 and on the
+windows and linux platforms.  Today you would have to 
+write down 2*2 = 4 ``[testenv:*]`` sections and then instruct
 tox to run a specific list of environments on each platform.
  
-With tox-1.X there will be no need to write down such boilerplate stuff.
-Without further ado, here is how a ``tox.ini`` would look like::
+With tox-1.X you can directlys specify combinations::
  
-    # combination syntax gives 2 * 2 * 2 = 8 testenv names
+    # combination syntax gives 2 * 2 = 4 testenv names
     #
-    envlist = [py26,py27]-[mypkg13,mypkg14]-[win,linux]
+    envlist = {py26,py27}-{win,linux}, {py31,py32}-linux
      
     [testenv]
     deps = pytest
-           # variant specific dependencies
-           mypkg13: mypkg<1.4
-           mypkg14: mypkg>=1.4,<1.5
-    platform=
+    platform =
            win: windows
            linux: linux
-    basepython=
+    basepython =
            py26: python2.6
            py27: python2.7
-
     commands = py.test
 
 Let's go through this step by step::
 
-    envlist = [py26,py27]-[mypkg13,mypkg14]-[windows,linux]
+    envlist = {py26,py27}-{windows,linux}
 
-This creates a list of ``2*2*2=8`` environment names.  It is
-a short form for writing the environments down explicitely
+This is bash-style syntax and will create ``2*2=4`` environment names
 like this::
 
-    envlist =  py26-mypkg13-windows, py26-mypkg13-linux,
-               py26-mypkg14-windows, py26-mypkg14-linux,
-               py27-mypkg13-windows, py27-mypkg13-linux,
-               py27-mypkg14-windows, py27-mypkg14-linux,
+    py26-windows
+    py26-linux
+    py27-windows
+    py27-linux
 
-Let's look at the next config item, the declaration of the generic
-testenv.  All the eight test environments will derive from this one.
-Unlike with earlier tox versions, there is no need to write down
-eight different ``[testenv:...]`` sections::
+Our ``[testenv]`` uses a new templating style for the ``platform`` definition::
 
-    [testenv]
-    deps = pytest
-           # variant specific dependencies
-           mypkg13: mypkg<1.4
-           mypkg14: mypkg>=1.4,<1.5
+    platform=
+           windows: windows
+           linux: linux
 
-This defines an unconditional dependency ``pytest`` which is going to be
-installed in all environments.  It also defines two conditional dependencies:
+With 
 
-- if ``mypkg13`` is part of the environment name, the ``mypkg<1.4`` spec 
-  will be used, otherwise the line is empty.
-- if ``mypkg14`` is part of the environment name, the ``mypkg>=1.4,<1.5`` spec 
-  will be used, otherwise the line is empty.
-
-The next configuration item defines the platform, depending on the
+ConcretelyThe next configuration item defines the platform, depending on the
 environment name for which the ``[testenv]`` is used::
 
-    platform=
-           win: windows
-           linux: linux
 
 These two conditional settings will lead to either ``windows`` or
 ``linux`` as the platform string.  When the test environment is run,
 
 Nothing special here :)
 
-However, as tox provides good defaults for platform and basepython
-settings, we can cut them out from our tox.ini::
+.. note::
 
-    envlist = [py26,py27]-[mypkg13,mypkg14]-[win,linux]
-     
-    [testenv]
-    deps = pytest
-           # variant specific dependencies
-           mypkg13: mypkg<1.4
-           mypkg14: mypkg>=1.4,<1.5
+    Tox provides good defaults for platform and basepython
+    settings, so the above ini-file can be further reduced::
 
-Voila, this ``tox.ini`` file defines 8 environments.
+        [tox]
+        envlist = {py26,py27}-{win,linux}
+         
+        [testenv]
+        deps = pytest
+        commands = py.test
+
+    Voila, this multi-dimensional ``tox.ini`` configuration 
+    defines 2*2=4 environments.
+
+Adding mypkg13,mypkg14 dependency variants
+--------------------------------------------
+
+XXX
+This defines an unconditional dependency ``pytest`` which is going to be
+installed in all environments.  It also defines two conditional dependencies:
+
+- if ``mypkg13`` is part of the environment name, the ``mypkg<1.4`` spec 
+  will be used, otherwise the line is empty.
+- if ``mypkg14`` is part of the environment name, the ``mypkg>=1.4,<1.5`` spec 
+  will be used, otherwise the line is empty.
 
  
 The new "platform" setting
 --------------------------------------
 
 A testenv can define a new ``platform`` setting.  If its value
-is not contained in the string obtained from calling ``platform.platform()``
-the environment will be skipped.
+is not contained in the string obtained from calling 
+``platform.platform()`` the environment will be skipped.
 
-Generator expressions in the envlist setting
+Expanding the ``envlist`` setting
 ----------------------------------------------------------
  
-The new ``envlist`` setting allows to use ``[CSV]`` expressions
-where ``CSV`` is a list of comma-separated values.  The basic
-generating algorithm works like this:
-                                                                                
-- expand: for each CSV-expression in an environment name in the list            
-  produce an additional environment name for each value in the CSV              
-- repeat: as long as there are CSV-expressions, continue the process            
+The new ``envlist`` setting allows to use ``{}`` bash-style
+expressions.  XXX explanation or pointer to bash-docs
 
+Templating based on environments names
+-------------------------------------------------
+
+For a given environment name, all lines in a testenv section which
+start with "NAME: ..." will be checked for being part in the environment
+name.  If they are part of it, the remainder will be the new line.
+If they are not part of it, the whole line will be left out.
+Parts of an environment name are obtained by ``-``-splitting it.
                                                                                 
 Variant specification with [variant:VARNAME]
 ----------------------------------------------
 
 tox comes with predefined settings for certain variants, namely:
 
-* ``[easy,pip]`` use easy_install or pip respectively
-* ``[py24,py25,py26,py27,py31,py32,py33,pypy19]`` use the respective
+* ``{easy,pip}`` use easy_install or pip respectively
+* ``{py24,py25,py26,py27,py31,py32,py33,pypy19]`` use the respective
   pythonNN or PyPy interpreter
-* ``[win32,linux,darwin]`` defines the according ``platform``.
+* ``{win32,linux,darwin}`` defines the according ``platform``.
 
 You can use those in your “envlist” specification 
 without the need to define them yourself.
+
+
+Use more bash-style syntax
+--------------------------------------
+
+tox leverages bash-style syntax if you specify mintoxversion = 1.4:
+
+- $VARNAME or ${...} syntax instead of the older {} substitution.
+- XXX go through config.txt and see how it would need to be changed
+
  
 Transforming the examples: django-rest
 ------------------------------------------------
 lines and almost no repetition::
  
      [tox]
-     envlist = [py25,py26,py27]-[django12,django13]-[,example]
+     envlist = {py25,py26,py27}-{django12,django13}{,-example}
  
      [testenv]
      commands = python setup.py test
          django12: django==1.2.4
          django13: django==1.3.1
  
-     [variant:example]
+     [envpart:example]
      commands = python examples/runtests.py
      +deps = 
          wsgiref==0.1.2
          httplib2==0.6.0
          Markdown==2.0.3
  
-Note that ``[,example]`` in the envlist denotes an empty env and the
-"example" variant.  The empty variant means that there are no specific
+Note that ``{,-example}`` in the envlist denotes an empty env and the
+"example" envpart.  The empty envpart means that there are no specific
 settings and thus no need to define a variant name. 
 
 Note also that ``+deps`` means that we are appending to dependencies,
 not substituting them.
+
  
 Transforming the examples: django-treebeard
 ------------------------------------------------
                                         --DATABASE_USER=root {posargs}
 
 It's noteworthy here that you can also use conditionals in the commands.
+
+
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.