Fix warnings.
Add pyflakes checks into test suite.
Fix newline.
Replace pyflakes with flake8 in the testsuite, and add configuration to tox.ini