Exemplo n.º 1
0
    def runTest(self):
        """ try echoing some text and see if it comes back out """
        p.send_all(self.shell, "echo hello\n")
        time.sleep(0.1)
        self.assertEqual(p.recv_some(self.shell), "hello\n")

        p.send_all(self.shell, "echo hello world\n")
        time.sleep(0.1)
        self.assertEqual(p.recv_some(self.shell), "hello world\n")

        p.send_all(self.shell, "exit\n")
        time.sleep(0.2)
        self.assertEqual("", p.recv_some(self.shell, e=False))
        self.assertRaises(Exception, p_recv_some_exception, self.shell)
Exemplo n.º 2
0
def p_recv_some_exception(*args, **kwargs):
    """Call recv_some with raise exception enabled"""
    kwargs['e'] = True
    return p.recv_some(*args, **kwargs)