[Zope] Help writing test where bobobase_modification_time changes
peter at fry-it.com
Tue Apr 8 14:08:27 EDT 2008
I'll try to explain as briefly as possible.
I've got a working cache pattern that keeps a cached version of a Zope
file's content and only when it changes (by >
bobobase_modification_time) the cache is invalidated and recreated.
Here's the gist of my test
""" bla """
url = self.folder.mytool.cacheFile('foo.js') # pseudo code this time
path = urlparse(url)
response = self.publish(path)
self.assert... tests on response...
_file = getattr(self.folder, 'foo.js')
newurl = self.folder.mytool.cacheFile('foo.js')
assert newurl != url, "url hasn't changed :("
The reason it fails on the last line is that the time difference
between the first time and the second time is nil. Adding a
time.sleep(1) won't change anything because the
bobobase_modification_time() doesn't change.
How can I solve this? Make one big transaction two without having to
use transaction.get().commit() which I don't think I can use in unit
tests as per Dieter's advice.
Grateful for help.
More information about the Zope