Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/40030
to review the following change.
Change subject: tests: Enable again utils.memoized in the tests ......................................................................
tests: Enable again utils.memoized in the tests
Tests that may leave dirt in memoized functions should invalidate the functions during teardown.
Since we disabled memoizing becuase of pulluted memoized functions in caps module, caps tests invalidate all memoized functions now.
Change-Id: I019e2a2ad75973511cccd195a7e9eaa105d8154f Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: http://gerrit.ovirt.org/37841 Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com Tested-by: Dan Kenigsberg danken@redhat.com --- M tests/capsTests.py M tests/testrunner.py 2 files changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/40030/1
diff --git a/tests/capsTests.py b/tests/capsTests.py index e3f7d6a..d0ac3d5 100644 --- a/tests/capsTests.py +++ b/tests/capsTests.py @@ -41,6 +41,13 @@
class TestCaps(TestCaseBase): + + def tearDown(self): + for name in dir(caps): + obj = getattr(caps, name) + if isinstance(obj, utils.memoized): + obj.invalidate() + def _readCaps(self, fileName): testPath = os.path.realpath(__file__) dirName = os.path.split(testPath)[0] diff --git a/tests/testrunner.py b/tests/testrunner.py index 13fe55e..37b4c95 100644 --- a/tests/testrunner.py +++ b/tests/testrunner.py @@ -411,10 +411,6 @@ raise AssertionError(msg)
-def fakeMemoized(func): - return func - - if __name__ == '__main__': if "--help" in sys.argv: print("testrunner options:\n" @@ -426,6 +422,4 @@
# Mock panic() calls for tests utils.panic = panicMock - # Memoization during tests is a bad idea. - utils.memoized = fakeMemoized run()