On Mar 1, 2010, at 10:48 AM, Caleb James DeLisle
wrote:
By clearing the XWikiContext in the tearDown of
the unit test, I can
stop the memory leak and stop running the tests in isolation. I am
proposing we apply this change because the XWikiContext is created
per test and the worst problem which can be created is tests
erroneously passing which I don't think is very likely from a change
like this.
+1 for the main reason that this improves build times. The second reason is that it
makes memory leaks more visible which gives us a better chance to find them (although this
won't replace performance tests running over a few days for ex).
However please add a comment just above the getContext().clear() to explain why this is
needed. BTW why is it needed? :)
I will do that. The reason it's needed is because (it seems) the
context is referenced by a static variable which isn't cleared and
rather than pick through the tests looking for where the reference
was (and hoping no test ever does it again) I opted to clear the
context and let the tests use the context as they wish. This is my
understanding of the situation.