Updated formatting in setup.py
Moved tests outside of source code to rely on unittest discovery mechanism
Ensure file handle is closed by using with statement