Fixes various tests for Python 3.x support

Besides test refactoring, we remove unused imports and we move  _W32TIME_SERVICE to the module scope.