[TIP] Converting a project from setup.py test to py.test

holger krekel holger at merlinux.eu
Tue Jul 29 04:35:37 PDT 2014


On Mon, Jul 28, 2014 at 22:03 +0100, Paul Moore wrote:
> On 28 July 2014 21:37, Paul Moore <p.f.moore at gmail.com> wrote:
> > I tried what I thought was the obvious approach, changing tox.ini to have
> >
> > [testenv:py27, pypy]
> > commands = py.test {toxinidir}/tests {posargs}
> > deps = pytest mock
> 
> Apparently, the syntax [testenv:py27, pypy] is wrong. And the
> dependencies must be on separate lines.

Yes.

> [testenv:py27]
> commands = py.test {toxinidir}/tests {posargs}
> deps = pytest
>   mock
> 
> I've no idea how that section header worked in the original version.
> And that multi-line syntax is a bit weird (but I guess it's
> configparser that's to blame for that one :-))

It's not configparser's fault, actually.  It's rather that when
tox was incepted we weren't sure how the dependency items would
evolve (and maybe contain a "comma" or space) and wanted to 
play it safe.

In fact, with the "conditional" syntax we are getting for tox-1.8
it's good that deps are one per line:

   [tox]
   envlist = {py26,py27,py34}-{django15,django16}

   [testenv]
   deps =
        ...
        django15: django>1.5,<1.6
        django16: django>1.6,<1.7

defines six environments and the "django15: " is a conditional
expression that can also work like "django15,django16: ". 
IOW, the "one per line" gives us more freedom to evolve syntax ...

best,
holger




> Paul
> 
> _______________________________________________
> 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