Hi Laurent,

On Thu, Jul 26, 2012 at 12:39 -0700, Brack, Laurent P. wrote:
> I was wondering if there was any way for a test case to retrieve a
> property containing arbitrary data that could be set by a hook?

Funcargs look like the natural place for this,
http://pytest.org/latest/funcargs.html

> An example could be a logger that has been opened specially for that
> test or conversely, the test could "attach" data which can be processed
> by a hook (example: test notes containing measurements, etc.) One could
> argue that the logger could be created by a factory but in this case,
> the test is correlated to a specific test case ID on our test management
> system (testlink) and this information is not available from a factory. 

Almost all information is available within funcarg factories and can thus
be made available to the test through injection.  For example, if you
have a decorator with a testcase-id then the factory can read it and
pass it along to the test etc.

> In one of our plugin, I am currently attaching "metadata" to "items" to
> convey information between hooks and I wished there was a way for the
> test itself to access this. Maybe there is, I just don't know about it. 

I need some simple example to understand why funcargs would not work
if they won't :)

best,
holger
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to