On Fri, Apr 07, 2006 at 02:35:57PM +0200, Florent Guillaume wrote:
> Paul Winkler wrote:
> >Using an Item or Folder as your root object for tests works fine except for
> >this one issue, so why not allow that?
> >My feeling is that setting up an app is unnecessary work when you
> >don't need one; for one thing, your test module needs to call
> >Zope2.startup() first; for another, afaict creating a Zope2.app is
> >a couple orders of magnitude slower than creating a SimpleItem.
> >So maybe more people *should* use makerequest(NotAnApp) ;-)
> FWIW usually in my tests I rarely use makerequest.
> On the other hand, when testing things that use traversal, it's very common
> that I have to define a fake root object whose getPhysicalPath returns
> ('',). It's only a few line, and makes my tests self-contained and much
> easier to understand than relying on the magic of a testing framework
> library (which I tend to hate).
I'm of two minds here. Those "only a few lines" add up very quickly.
I hate wading through 50 lines of setup for every two lines of actually
testing something. On the other hand, it's annoying when the test
framework magic does something unexpected. You just can't win. :-(
Whipping up my own request-wrapped root object for reuse internally
seems like a good solution.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -