Emit proper error message when tests.sort() failed

In Python 3.3, if there are duplicate test names, tests.sort() will
fail and raise TypeError.

Detect the duplicate test names when exception raised, and print
them to stderr.

Close-Bug #1243922