Fixes 899174 r=@gabithume, @peterbe, @brandonsavage

* PEP8 fixes
* Cleanup of debugging
* Refactor tests to use a dict and a loop
* Remove signatures subselect
* Be sure to truncate all tables in tests