Fix tests, remove duplicated and outdated (obsolete) test templates
Port to python 3