Remove __main__ code from tests