Test refactoring, drop support for Python 2.4