[Grok-dev] z3c.testseup: populating globs and test layers

Uli Fouquet uli at gnufix.de
Wed Oct 21 08:42:29 EDT 2009


Hi JW,

Jan-Wijbrand Kolman wrote:

>  From the z3c.testsetup pypi page:
> 
> """
> globs:
> 
> A dictionary of things that should be available immediately (without 
> imports) during tests. Default is an empty dict, which might be 
> populated by appropriate layers (see below). ZCML layers for example get 
> you the getRootFolder method automatically.
> 
> This parameter is a fallback which can be overriden by testfile markers 
> specifying a certain layer (see below).
> 
> The globs parameter applies only to doctests, not to plain python unittests.
> """
> 
> This is exactly what I need; populating a test's globals from a layer.
> 
> Except, it doesn't work.
> 
> Or, at least, I do not see how.

Me neither. The docs should be updated.

> There's no documentation on how to do this and if I look at 
> z3c.testsetup and zope.app.testing code, I do not see how you can get to 
> the actual test's globals at all - layers have no reference to the test.
> 
> Am I doing something wrong here?

I don't think so. The only chance to get a reference to the tests (and
update the globs) is to create a custom setup function using ':setup:'
markers (AFAIS).

I wonder, whether there is a special reason for testing layers not to
deliver the single tests to the setup code of layers (although this is
not the scope of z3c.testsetup).

Best regards,

-- 
Uli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20091021/c23a0f33/attachment.bin 


More information about the Grok-dev mailing list