Fixing the tests to run again

Also some minor pep8 and pylint fixes.

Change-Id: I22348710a7829197b539830f6acdc92b619bdc0c