Improve test infrastructure. PEP8 fixes.