This solves problems in tearDown of individual test cases, which were especially noticeable on Windows.
When a test throws an exception, the exception retains references to the functions in the stack, which in term keeps their local variables alive. When those locals are SB proxy objects, cleanup doesn't proceed as it should because they keep LLDB objects alive that should have been orphaned.
By moving the running of the test method to a separate function, we ensure that the exception goes out of scope before we attempt tearDown, and the gc.collect() makes sure the orphaned objects are properly destroyed before the framework attempts to delete the target.
Without this fix, a test case that throws might cause the shared module list to retain an open handle to the inferior, even after the target is deleted. This affects the state of subsequent test cases in the same test. This was especially noticeable on Windows in tests like TestTargetAPI, because the open handle prevented make from deleting the inferior after the failed test case and the next test case from re-building the inferior. Thus nearly all tests cases would fail because of a problem in just one.