z3c.testseup: populating globs and test layers

View: New views
2 Messages — Rating Filter:   Alert me  

z3c.testseup: populating globs and test layers

by Jan-Wijbrand Kolman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,


 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.

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?

regards,
jw

_______________________________________________
Grok-dev mailing list
Grok-dev@...
https://mail.zope.org/mailman/listinfo/grok-dev

Re: z3c.testseup: populating globs and test layers

by Uli Fouquet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



_______________________________________________
Grok-dev mailing list
Grok-dev@...
https://mail.zope.org/mailman/listinfo/grok-dev

signature.asc (196 bytes) Download Attachment