[TIP] (RFC) multi-dimensional/variant tox configuration (V1)
holger krekel
holger at merlinux.eu
Tue Jul 10 03:09:00 PDT 2012
Hi Stefan,
On Tue, Jul 10, 2012 at 10:20 +0200, Stefan Scherfke wrote:
> Hi Holger,
>
> I really like the idea. However, I found one bug and have one note:
>
> > Generating and selecting variants
> > ----------------------------------------------
> >
> > …
> >
> > Without much further introduction, here is an example ``tox.ini``::
> >
> > envlist =
> > py[26,27,32,py]-mypkg[13,14]
> >
> > …
> >
> > [testenv-mypkg13]
> > +deps = mypkg<1.4
> >
> > [testenv-django14]
> > +deps = mypkg<1.5
>
> I think it should be “testenv-mypkg14” instead of “testenv-django14”?
right.
> > 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
> >
> >
> > Generator expressions in the envlist setting
> > ----------------------------------------------------------
> >
> > Generator expressions in the ``envlist`` work like this:
> >
> > * ``[...]`` parts contain a comma-separated list of names. Each name
> > will generate a new environment reference.
> > * repeat the process until there are no more generator expressions
>
> I think you should make it more clear that:
>
> * you split the envlist entries by “-” --> ['py[26,27,32]', 'mypkg[13,14]']
> * you then expand the generator expressions --> [['py26', 'py27', 'py32'], ['mypkg13', 'mypkg14']]
> * and finally compute the cartesian product of that nested list.
> * you can create a section for each item in the resulting list (i.e., “py26” or “mypkg13”)
> * some of theses entries are predfined in tox (i.e. py26, pypy, …) (you state this later, but it would be more helpful to remind the reader a bit earlier)
It's a bit underspecified, i agree. The algorithm i had in mind
works slightly different. Consider we have a list of environment
names, some of which may contain [CSV]-generator expressions where
the CSV part is a comma-separated list of variants. We
then enter a loop as long as there are such expressions and then:
- expand: for each CSV-expression in an environment name in the list
produce an additional environment name for each value in the CSV
- repeat: as long as there are CSV-expressions, continue the process
Moreover, variants are defined by respective [testenv-VARIANT] sections.
If neccessary, one can still override/special case a certain
[testenv:VAR1-VAR2...] section by defining it.
I believe it's all effectively very similar to what you describe except
that there does not need to be special treatment of the "-" character.
best,
holger
>
> Cheers,
> Stefan
More information about the testing-in-python
mailing list