[py-dev] greppability of factories (was: Re: new resource API nearing completion including impl)

holger krekel holger at merlinux.eu
Fri Aug 3 18:37:07 CEST 2012


On Thu, Aug 02, 2012 at 20:03 +0000, holger krekel wrote:
> On Thu, Aug 02, 2012 at 19:47 +0100, Floris Bruynooghe wrote:
> > On 2 August 2012 18:24, holger krekel <holger at merlinux.eu> wrote:
> > > On Thu, Aug 02, 2012 at 13:50 +0100, Floris Bruynooghe wrote:
> > >> Would it not make sense to allow this (or at least provide a clearer
> > >> error)?  I still like that form because of the grep-ability (doing a
> > >> 2-line grep is much harder and would still not cover ppl doing "from
> > >> pytest import factory" etc).
> > >
> > > Grepability is an argument.  Would adding a "name=..." parameter for
> > > the factory-decorator help enough?  Allowing and advertising
> > > pytest_funcarg__foo feels strange to somehow taking a fresh look i think.
> > 
> > I would argue the opposite, allowing the @factory decroator on
> > pytest_funcarg__* seems like a more gentle progression giving more the
> > impression that it is simply funcargs evolved.  To a newcomer it might
> > otherwise look like funcargs where not thought out fully yet and make
> > them think py.test just isn't stable enough yet.
> 
> But when using the factory decorator on pytest_funcarg__ named functions,
> they shall at least not be able to receive "request" anymore, right?
> (The current implementation probably allows it but i feel uneasy about it).

One more thought: What will actually happen  if you grep for "def
FUNCARGNAME" - does this not usually yield the location of your factory
and very few or no false positives?

holger



More information about the Pytest-dev mailing list