[ZODB-Dev] Re: Snapshotting state with DemoStorage

Stefan H. Holek stefan at epy.co.at
Wed May 28 06:54:23 EDT 2008


On 28.05.2008, at 09:48, Martin Aspeli wrote:

> I think the main problem is that I'm not terribly familiar with how  
> DemoStorage works, or how the Zope server (in a test case) ends up  
> getting its database. I'm worried that I may be asking the "wrong"  
> questions here, but to my mind, the three questions would be:

The tests get their database from Testing.custom_zodb.py

> - how can I use DemoStorage to snapshot a known state and then  
> return to it at all

See ZopeLite.sandbox

> - how can I ensure that this is the storage that the Zope server sees

See sandbox.Sandboxed and the AppZapper class

> - how can I actually access a server that's running inside a  
> ZopeTestCase over a URL, i.e. ensure that it binds to a port and  
> serves requests for the duration of the test run

ZopeTestCase.utils.startZServer()

And then something like urllib.urlopen(self.portal.absolute_url())

--
Stefan H. Holek
stefan at epy.co.at



More information about the ZODB-Dev mailing list