Create a TestCaseWithLog class and refactor some tests to work with it
Remove useless StringIO imports