[TIP] tox config format

holger krekel holger at merlinux.eu
Fri Jan 7 06:47:02 PST 2011


Hi Michael, Hi Alex,

On Fri, Dec 17, 2010 at 18:00 +0000, Michael Foord wrote:
> On 17/12/2010 17:28, Alex Gaynor wrote:
>> Fellow Testers,
>>
>> I spent a bit of time this morning setting up tox for one of my  
>> projects, django-taggit (https://github.com/alex/django-taggit).  It's  
>> awesome, in addition to testing with multiples pythons it's easy to  
>> test multiple versions of Django by creating custom testenvs and  
>> altering the deps.  However, it's rather verbose: most of the items:  
>> https://github.com/alex/django-taggit/blob/master/tox.ini are  
>> copy-pastes of one another.  I'm wondering whether there isn't  
>> something that could be done to simplify this, some way to take the  
>> set of base envs (py25, py26, etc.) and parameterize them along some  
>> axis, such as deps.  I don't have a specific syntax proposal, but I'm  
>> curious if anyone else does.
>>
>
> +1
>
> Setting up tox is not hard, so props to Holger for that, but when you  
> are configuring multiple interpreters there is a lot of repetition.

I'd be grateful for some more real-life tox.ini file examples with repetition like
the one Alex posted to consider implementing some config format for specifying
variants less verbosely. One idea might beallow defining defaults for
[testenv:NAME1] such that

    [testenv:NAME1:a1]
    ...
    [testenv:NAME1:a2]
    ...

etc. would use the extended defaults. Alex's tox.ini would
considerably simplify to something like this:

    [tox]
    envlist =
        py24, py25, py26, py27, pypy, py24:alpha1, py25:alpha1, py26:alpha1,
        py27:alpha1, pypy:alpha1, docs

    [testenv]
    commands = python setup.py test
    deps = django==1.2.3  

    [testenv:alpha1]
    deps = http://www.djangoproject.com/download/1.3-alpha-1/tarball/

    [testenv:docs]
    changedir = docs
    deps =
        sphinx
    commands =
        sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
        sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck

makes sense to you?

cheers,
holger

> All the best,
>
> Michael Foord
>
>> Alex
>>
>> -- 
>> "I disapprove of what you say, but I will defend to the death your  
>> right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
>> "The people's good is the highest law." -- Cicero
>> "Code can always be simpler than you think, but never as simple as you  
>> want" -- Me
>>
>>
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>
>
> -- 
>
> http://www.voidspace.org.uk/
>
> May you do good and not evil
> May you find forgiveness for yourself and forgive others
> May you share freely, never taking more than you give.
> -- the sqlite blessing http://www.sqlite.org/different.html
>

> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python


-- 



More information about the testing-in-python mailing list