Fix tests and lint with flake8.