Fix test_socket for repr update
Avoid global side effect in test_ensurepip