What I usually do in that case is extract the actual method to a "private" 
underscore method without caching, but keep the memoizer on the "public" method 
that only calls the private method. And then unittest the private method, while 
calling the public method in production code. Ugly but effective.

Another approach is to insert a randomized parameter, e.g. In your case a 
variable in the request which has no effect other than that it results in a 
request that "looks" different as a cache key, even though it is functionally 
equivalent.

Guido
--
   Guido Stevens  |  +31.43.3618933  |  http://cosent.nl

   s o c i a l   k n o w l e d g e   t e c h n o l o g y


On 6 jun. 2013, at 19:20, Héctor Velarde <hector.vela...@gmail.com> wrote:

> hi there!
> 
> I'm writing a test for a method memoized with view.memoize but calling it 
> many times inside my test is bringing the same results (as expected) because 
> I have the same context/request.
> 
> is there any easy way to turn off or invalidate the cache inside the test?
> -- 
> Héctor Velarde
> 
> 
> _______________________________________________
> Product-Developers mailing list
> product-develop...@lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers
_______________________________________________
Product-Developers mailing list
product-develop...@lists.plone.org
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to