From 1a7868d27f2cbf996a7069f2ccc187bcddcbb7f9 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Thu, 14 Jul 2005 02:36:56 +0000 Subject: [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-39] bulletproof the select test in test_transport more --- tests/test_transport.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test_transport.py b/tests/test_transport.py index d25db528..ecea6e19 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -411,8 +411,12 @@ class TransportTest (unittest.TestCase): schan.send('hello\n') - # something should be ready now - r, w, e = select.select([chan], [], [], 0.1) + # something should be ready now (give it 1 second to appear) + for i in range(10): + r, w, e = select.select([chan], [], [], 0.1) + if chan in r: + break + time.sleep(0.1) self.assertEquals([chan], r) self.assertEquals([], w) self.assertEquals([], e) @@ -425,6 +429,17 @@ class TransportTest (unittest.TestCase): self.assertEquals([], w) self.assertEquals([], e) - chan.close() schan.close() + # detect eof? + for i in range(10): + r, w, e = select.select([chan], [], [], 0.1) + if chan in r: + break + time.sleep(0.1) + self.assertEquals([chan], r) + self.assertEquals([], w) + self.assertEquals([], e) + self.assertEquals('', chan.recv(16)) + + chan.close() -- cgit v1.2.3