def _get_input(self, prompt): """ Helper method to take input if input is a tty """ if is_term(): return raw_input(prompt) return 'y'
def test_is_term_has_fileno(self): with tempfile.TemporaryFile() as fd: save = sys.stdout sys.stdout = fd assert_equals(False, utils.is_term()) sys.stdout = save
def test_is_term_not_term(self): # Default under nostests is no assert_equals(False, utils.is_term())