Hi All,

I've been having fun with unit tests:

http://mail.zope.org/pipermail/zope3-dev/2006-October/020757.html

http://mail.zope.org/pipermail/zope3-dev/2006-October/020775.html

But Jim finally pointed me in the right direction:

http://mail.zope.org/pipermail/zope3-dev/2006-October/020789.html

So, stacking DemoStorages sounds like exactly what I want to do, with one DemoStorage for each test layer.

A couple of questions:

1. Should I do a transaction.commit() after each layer's setup, or will a DemoStorage stacked onto another DemoStorage as follows:

storage = DemoStorage(base=base_storage)

...still see all changes made to the base even if they're not committed?

2. How do I go about weaving the storage into the Zope2.app() stuff? In
   particular:

   - in a layer's setUp() method, how do I replace the DB used by the
     current Zope2.app() with the same storage but wrapped in a new
     DemoStorage?

   - in a layer's tearDown() method, how do I toss the DemoStorage
     created in the layer's setUp and replace it with the original one?

3. Is storage = DemoStorage(base=base_storage) and the dance needed for
   question 2 going to be quicker that transaction.commit() at the end
   of the layer setup and transaction.abort() at the end of every unit
   test?

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to