Francesco Romani has submitted this change and it was merged.
Change subject: utils: Add memoized invalidation ......................................................................
utils: Add memoized invalidation
We learned in the hard way that memoizing and monkey-patching do work nicely together. However, disabling memoizing during the tests means that we do not test the same code in the application.
This patch adds invalidate() method to memoized functions, so tests can clean up properly after they modify memozied data.
This can also be used by application code to invalidate memoized functions in certain conditions.
Change-Id: I3053b8ecc567f7c3154f7473dfd6b587823313ae Signed-off-by: Nir Soffer nsoffer@redhat.com Bug-Url: https://bugzilla.redhat.com/1267851 Reviewed-on: http://gerrit.ovirt.org/37788 Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Piotr Kliczewski piotr.kliczewski@gmail.com Reviewed-by: Dan Kenigsberg danken@redhat.com Reviewed-on: https://gerrit.ovirt.org/40029 Tested-by: Francesco Romani fromani@redhat.com Continuous-Integration: Francesco Romani fromani@redhat.com --- M lib/vdsm/utils.py M tests/utilsTests.py 2 files changed, 67 insertions(+), 1 deletion(-)
Approvals: Piotr Kliczewski: Looks good to me, but someone else must approve Nir Soffer: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved Francesco Romani: Verified; Passed CI tests