[TIP] [tox] multiple source dependencies
Chris Withers
chris at simplistix.co.uk
Tue Jul 10 09:42:40 PDT 2012
Hi Holger,
On 09/07/2012 22:11, holger krekel wrote:
>> Does Tox do any logging about what sdist it's using for a particular
>> package? (or whether or not it's being downloaded from an index?)
>>
>> If not, could it be added?
>
> Not sure but maybe "-vv" already shows it - might have gone during
> the recent report related refactoring though.
Any chance you could check? Sounds like you've been in this code
recently ;-)
>> Yes, but that's not really appropriate here, it's only for certain
>> jobs I want to use these manufactured sdists, the rest I want to go
>> to PyPI...
>>
>> (in fact, thinking about this more, it's actually worse than that...
>> I may *have* to resort to use #git links as I actually want to do
>> some matrix testing where the axes are:
>>
>> - python version
>> - platform
>> - xlrd/xlwt release (master branch, latest released version, last
>> 0.7.x version)
Interested how you'd approach the above requirements...
Sat Jul 7 06:58:53 PDT 2012, holger krekel wrote:
> - there is no way to define dependency or other variants in tox.ini files,
> instead you have explicitely spell out all combinations in
> separate testenvs. Examples:
Explicit isn't such a bad thing, but yes...
> - tox always uses pip currently. So there is no check for your packages
> that installing with easy_install will work. Moreover, some packages,
> like greenlet on Win32, require easy_install if you have no suitable
> C-compiler on the machine. Tox cannot be used then currently.
Yeah, support for easy_install and buildout would be interesting, but I
don't think they're a requirement for me...
> Without much further introduction, here is an example ``tox.ini``::
>
> envlist =
> py[26,27,32,py]-mypkg[13,14]
Why not * instead of - here? It's a cross product after all ;-)
> [testenv]
> deps = nose
> commands = nosetests
>
> [testenv-mypkg13]
> +deps = mypkg<1.4
>
> [testenv-django14]
> +deps = mypkg<1.5
I don't follow he django14 here?
> If you don't want to run django-mypkg with pypy the envlist would look like
> this::
>
> envlist =
> py[26,27,32]-mypkg[13,14]
> pypy-mypkg14
Don't quite follow here either I'm afraid :-S
> Showing all expanded sections
> -------------------------------
>
> To help with understanding how the variants will produce section values,
> you can ask tox to show their expansion with a new option:
>
> $ tox -l
> [XXX output ommitted for now]
This will definitely be useful :-)
> Transforming the examples: django-rest
> ------------------------------------------------
>
> The original `tox.ini <http://code.larlet.fr/django-rest-framework/src/eed0f39a7e45/tox.ini>`_ file has 159 lines and a lot of repetition, the new one would
> have 26 lines and almost no repetition::
>
> [tox]
> envlist = py[25,26,27]-django[12,13]-[example]
I'd definitely prefer:
py[25,26,27]*django[12,13]*[example]
The - would be useful, but in the same way as you have +deps, you could
have -deps meaning "remove this package just for this combination".
> [testenv]
> commands = python setup.py test
>
> deps=
> coverage==3.4
> unittest-xml-reporting==1.2
> Pyyaml==3.10
>
> [testenv-django12]
> +deps= django==1.2.4
>
> [testenv-django12]
> +deps= django==1.2.4
Hypothetically, how would I do a set of runs for each python version
where no Django is present at all?
> [testenv-example]
> deps =
> wsgiref==0.1.2
> Pygments==1.4
> httplib2==0.6.0
> Markdown==2.0.3
Am I right in reading the above as -example would *always* be added to
the testenv and so there would be no test runs where the above deps
aren't added? Maybe I'm missing something...
> Transforming the examples: django-treebeard
> ------------------------------------------------
>
> Another `tox.ini <https://bitbucket.org/tabo/django-treebeard/raw/93b579395a9c/tox.ini>`_ has 233 lines and runs tests against multiple Postgres and Mysql engines in the same testenv section. We can easily split this and reduce to 39 non-repetive lines::
>
> [tox]
> envlist =
> py[24,25,26,27]-django[11,12,13]-[nodb,pg,mysql]
> docs
>
> [testenv:docs]
> changedir = docs
> deps =
> Sphinx
> Django
> commands =
> make clean
> make html
>
> [testenv]
> deps=
> coverage
> MySQL-python
> psycopg2
> pysqlite
Why do these all appear here when they appear to be added below?
> [testenv-nodb]
> +deps=pysqlite
> commands =
> {envpython} runtests.py {posargs}
>
> [testenv-pg]
> +deps = psycopg2
> commands =
> {envpython} runtests.py --DATABASE_ENGINE=postgresql_psycopg2 --DATABASE_USER=postgres {posargs}
>
> [testenv-mysql]
> +deps = MySQL-python
> commands =
> {envpython} runtests.py --DATABASE_ENGINE=mysql --DATABASE_USER=root {posargs}
>
> [testenv-django10]
> +deps = Django==1.0.4
Hope this feedback helps, looks like it's going to be good however it
ends up :-)
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
More information about the testing-in-python
mailing list