[TIP] How to combine a dependency list and conditions with Tox
Marius Gedminas
marius at gedmin.as
Sun Dec 13 22:34:31 PST 2015
On Sat, Dec 12, 2015 at 10:14:39AM -0500, Chris Spencer wrote:
> 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:
>
> [tox]
> envlist = {py2.7,py3.0,py3.4}-{django1.5,django1.6,django1.7,django1.8}
>
> [testenv]
> 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.
I would try
[testenv]
basepython =
...
deps =
django1.7: Django >= 1.7, < 1.8
django1.8: Django >= 1.8, < 1.9
django1.9: Django >= 1.9, < 1.10
-r {toxinidir}/pip-requirements.txt
It's OK if pip-requirements.txt also includes Django.
Marius Gedminas
--
Vi has excellent support for the PC speaker. Nearly every key combination will
invoke the PC speaker to make use of this.
-- G_Morgan on reddit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20151214/7a674926/attachment.pgp>
More information about the testing-in-python
mailing list