Make test.py run the most recently built binary.
Fix compatibility with Python 2.5.

Fixes #1049.