Run pyflakes during test and fix errors