Only run test_curses when sys.__stdout__ is a tty. This eliminates the