[TIP] finalizing tox's new parametrized configuration (RFC)

holger krekel holger at merlinux.eu
Fri Aug 8 02:32:28 PDT 2014

On Thu, Aug 07, 2014 at 09:08 -0600, Carl Meyer wrote:
> On 08/07/2014 01:48 AM, holger krekel wrote:
> > 
> > I'd like to ask for suggestions/feedback regarding finalizing
> > the new tox parametrization configuration syntax.  What we currently have:
> > 
> > https://testrun.org/tox/dev/config.html#generating-environments-conditional-settings
> This all looks lovely!

great! :) You can already install it, btw with:

    pip instal --pre -U -i https://devpi.net/hpk/dev/ tox 

It is unlikely to change much before 1.8 (we only need to add the AND/OR syntax).

> > The question now is how to complete the "factor conditional settings" syntax
> > with "OR" and "AND" operations.  We are discussing it on this issue:
> > 
> >     https://bitbucket.org/hpk42/tox/issue/183/boolean-algebra-and-factors
> > 
> > I currently lean towards using "," for OR and "-" for AND and am now looking
> > at my own tox.ini usages.
> I agree; "," for OR and "-" for AND feels consistent with existing
> tox.ini syntax. I'd have no problem with that.

OK, this confirms my and Alex' intuition and as you have taught tox in a course
yourself i value your feedback a lot :)  The only issue so far seems
to be that if you also use negation it looks a bid odd: "py27-!django15"
but i think it's not a very likely common case.

> > Any opinions?  Do you have tox.ini files which use combinations (currently
> > by exhaustively explicitely listing them) and can post them here so we 
> > could see to transform them using the new syntax?  
> Sure; here is one that I haven't yet gotten around to simplifying at
> all, not even with substitutions for common dependencies:
> https://github.com/carljm/django-model-utils/blob/master/tox.ini

Using the new syntax your tox.ini should collapse like this::

    envlist = {py26,py27,py32,py33}-{1.4,1.5,1.6},
    deps =
        coverage == 3.6
        1.4: Django == 1.4.10
        1.5: Django == 1.5.5
        1.6: https://github.com/django/django/tarball/stable/1.6.x
        trunk: https://github.com/django/django/tarball/master
        1.4: South == 0.7.6
        1.5,1.6: South == 0.8.1

    commands = coverage run -a setup.py test

Pretty succinct, isn't it?
(the current development tox referenced above does not understand the
AND "," yet, though, so you'd have to double that line, otherwise it
should already work).


More information about the testing-in-python mailing list