Removing duplicate test.
Many small changes so that the codebase adheres to flake8.

Mainly removing duplicate imports or unused imports.
Travis now uses flake8