[Zope3-Users] Re: Questions about placefull vs placeless tests

Philipp von Weitershausen philipp at weitershausen.de
Tue Feb 1 19:11:45 EST 2005


Amos Latteier wrote:
> I'm trying to figure out the differences between placefull and placeless 
> unit tests.
> 
> I think that I understand the use of zope.app.tests.placelesssetup. It 
> seems to allow you to setup the component architecture so that you can 
> register adapters and views in your unit tests. I'm unclear on which if 
> any ZCML configuration files are used in these cases (it seems that none 
> are, since adapters have to be manually registered in unit tests.)

Correct.

> I'm less clear on when it's necessary or a good idea to use 
> placefulSetUp. It seems to give you access to a site object, though I 
> would assume that most of the stuff you'd do with a site object should 
> be done with a functional rather than a unit test. I do see examples of 
> using placefulsetup in order to allow a class to implement 
> IAttributeAnnotatable. I don't understand if/why this is necessary.

PlacefulSetUp is good when unit testing local components (in contrast to 
PlaclessSetUp which you'll need when testing global components). 
PlacefulSetUp exposes a folder/site structure that gives your local 
component just enough context to be tested.

This *is* still different from a functional test where all of Zope is 
treated more or less as a black box and you test certain functionality 
(that happens to be implemented by that component).

Philipp



More information about the Zope3-users mailing list