[py-dev] new resource API nearing completion including impl
holger krekel
holger at merlinux.eu
Wed Aug 1 15:18:02 CEST 2012
Hi all,
I've just uploaded new docs and my latest changes to the newstyle funcargs
and setup mechanism. I am getting increasingly happy about it and think
i solved most of the implementation problems now. I also moved to
writing direct release-relevant documentation now. The new main doc is
http://pytest.org/dev/resources.html
It contains a number of working examples. To play yourself you can use
the repo or use "pip install -i http://pypi.testrun.org -U pytest".
Mostly due to implementation but also for communication reasons
i resolved to advertising a "newstyle" API that does not fully include
the oldstyle API. Mainly you cannot use the "request" object in
setup/factory-marked functions. Intstead there is a more minimal
"testcontext" object which specifically does not offer
cached_setup/getfuncargvalue because you can and should now directly use
funcargs in factory/setup functions. Nevertheless, old-style and
new-style resources can use each other and i think i managed full
backward compatibility.
If i see it correctly there is at least one open issue that was
originally raised by Floris that is not covered yet: How to write a
setup-function that instantiates an object depending on the presence of
a "@needsdb" marker. I have several ideas about this but probably it's
best to discuss this on IRC ...
best,
holger
More information about the Pytest-dev
mailing list