[py-dev] new resource API nearing completion including impl
holger krekel
holger at merlinux.eu
Thu Aug 2 19:24:19 CEST 2012
On Thu, Aug 02, 2012 at 13:50 +0100, Floris Bruynooghe wrote:
> On 2 August 2012 11:44, holger krekel <holger at merlinux.eu> wrote:
> > http://pytest.org/dev/setup.html
> >
> > Hope the latter begins to make more sense.
>
> Yes, it does. I now see the power @setup. One thing you might want
> to add is compare the module-global setting to simply using the
> "global" statement inside the setup function.
Do you mean that in the case where the global-setting happens in the
conftest.py using "global" does not work?
> Btw, is it a bug in the assertion that when using a global variable
> the assert-printing does not seem to show the value of that global
> variable?
I noticed this as well and consider it a bug, yes.
> > I still intend to refine docs and add more examples but now is lunch and
> > then child-care summer party time :)
>
> I hope you're having a better summer to party in then the torrential
> rain we seem to be getting this afternoon ;-)
Yes, almost too hot here actually ...
> > I also uploaded a new package pytest-2.3.0.dev8 to be installed
> > via:
> >
> > pip install -i http://pypi.testrun.org -U pytest
>
> I was playing with this over lunch and discovered this doesn't work:
>
> @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.
> 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?
best,
holger
>
> Regards,
> Floris
> _______________________________________________
> py-dev mailing list
> py-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
>
More information about the Pytest-dev
mailing list