Fix formatting indices present in python 2.6.

Change the way the tests.cluster file is generated to handle multiple runs of the same test. We were appending more jobs to the same file, thus causing collisions. References #4222