[patch] hashcache fixes

Robert Collins robertc at robertcollins.net
Tue Jul 11 04:53:38 BST 2006


On Mon, 2006-07-10 at 21:37 +1000, Andrew Bennetts wrote:
> On Mon, Jul 10, 2006 at 04:59:05PM +1000, Andrew Bennetts wrote:
> [...]
> > Looking at the problem from a strict testability point of view, this suggests
> > the code isn't factored well enough.  What if the _fingerprint function was a
> > method of HashCache objects instead, so test cases can override it to return
> > modified results -- e.g.:
> 
> It occurs to me that to completely factor out external stuff that we can't
> control, the same principle applies to the use of time.time().  Hashcache could
> have a "now" method that just does "return time.time()", and tests could
> override it.  This way tests can completely control all the variables involved
> in get_sha1, and thus test all the logic deterministically.

This is an approach to simulation, which I was promotting in my response
as well.

Martin, with two of us saying, please test the use of the interface, not
the interface, are you convinced ?

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060711/418bd8fc/attachment.pgp 


More information about the bazaar mailing list