That thread is 6 months old, but I see that it is still relevant.
holger krekel wrote:
Hi Philippe,
On Wed, Oct 28, 2009 at 10:09 +0100, Philippe Fremy wrote:
I had a quick look at the plugin architecture to see if I could
implement an equivalent of setup/teardown at directory level, but I
don't think it's possible.
Whatever is called for "directory" setup could live in a conftest.py file.
The question is how to transfer any "directory" setup state
to a module. At first i thought one could write down:
# ./conftest.py
def setup_module(mod):
# will be called for all modules in/below the dir
mod.something = "value"
but one would expect this to be called for each module and not
just once for a whole directory. Now one could perform some
directory-level caching but one conceptual issue remains:
values would be "magically" injected into the test modules.
Do you have ideas about how you'd like the API to work?
Yes, I now know how I want to transfer the value. I would like to use
the py.test namespace.
Today, only pytest_namespace() is available to setup an initial
namespace. I would like to see a pytest_update_namespace() to pass a
dict with key/values to put in the namespace.
cheers,
Philippe
|
_______________________________________________
py-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/py-dev