I've been having fun with unit tests:
But Jim finally pointed me in the right direction:
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
- 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
- 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
Simplistix - Content Management, Zope & Python Consulting
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -