[Zope] Help writing test where bobobase_modification_time changes

Dieter Maurer dieter at handshake.de
Wed Apr 9 14:50:20 EDT 2008


Peter Bengtsson wrote at 2008-4-8 19:08 +0100:
> ...
>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?

Not easy.

"bobobase_modification_time()" is in fact a "DateTime" representation
of "_p_serial". And "_p_serial" is the transaction id (also a timestamp)
that has committed the object state belonging to this object incarnation.

Unfortunately, you must not commit a transaction in a test suite
(as this may cause interference with other tests).

There is a small chance that a savepoint changed "_p_serial" --
but the chance is only small...

You might be able to write "_p_serial" yourself and thereby
trick "bobobase_modification_time()".



-- 
Dieter


More information about the Zope mailing list