Cleanup the import statements in the tests

The flake8 tool reported a number of import statement with modules being
imported but not used, and the use of 'import *'. This is an attempt to
clean up some of these issues to the codebase in general.