[TIP] How to combine a dependency list and conditions with Tox

Chris Spencer chrisspen at gmail.com
Sat Dec 12 07:14:39 PST 2015

How do you configure Tox to use a pip requirements.txt file, but also
conditionally override that file to test a particular package version?

I maintain a few packages that depend on Django and I like to test them
against multiple versions of Python and Django, but I don't see any easy
way to do this with Tox.

According to the docs (
http://blog.ionelmc.ro/2015/04/14/tox-tricks-and-patterns/) you can specify
a package dependency file like:

    deps = -r{toxinidir}/pip-requirements.txt

and you can also conditionally specify depedencies like:

    envlist = {py2.7,py3.0,py3.4}-{django1.5,django1.6,django1.7,django1.8}

    basepython =
        py2.7: python2.7
        py3.0: python3.0
        py3.4: python3.4
    deps =
        django1.5: Django>=1.5,<1.6
        django1.6: Django>=1.6,<1.7
        django1.7: Django>=1.7,<1.8
        django1.8: Django>=1.8,<1.9

How would you combine these two? I can't find any hint in the docs for how
to accomplish this.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20151212/1cf99d02/attachment.html>

More information about the testing-in-python mailing list