On Thu, Aug 02, 2012 at 19:47 +0100, Floris Bruynooghe wrote: > On 2 August 2012 18:24, holger krekel <hol...@merlinux.eu> wrote: > > On Thu, Aug 02, 2012 at 13:50 +0100, Floris Bruynooghe wrote: > >> @pytest.factory(scope='session') > >> def pytest_funcarg__foo(): > >> return 42 > >> > >> 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.
If we are to optionally allow pytest_funcarg__ naming with @pytest.factory i wonder if renaming @pytest.factory to @pytest.funcarg would make sense and contribute to the notion that pytest-2.3 just extends funcarg facilities. The reason i favored @factory is that it really marks a factory function whereas "funcarg" more denotes the argument in a test or setup function. Moreover, the pytest-2.2 documentation already talked about factories when refering to pytest_funcarg__ functions. (And @funcargfactory seems a tad long to me). However, i can't claim to have much of an outside view so i am interested in your and other opinions. best, holger > > >> Also doing this results in setup_module being called twice: > >> > >> @pytest.setup(scope='module') > >> def setup_module(): > >> print 'setting up module' > >> > >> I'm not sure what the correct behaviour should be here. > > > > Hum, I think the decorator "consumes" the function and it should not > > be considered for anything else. Do you agree? > > Yes, that's probably the best option. > > > Regards, > Floris > _______________________________________________ > py-dev mailing list > py-dev@codespeak.net > http://codespeak.net/mailman/listinfo/py-dev > _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev