[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-39]

bulletproof the select test in test_transport more
This commit is contained in:
Robey Pointer 2005-07-14 02:36:56 +00:00
parent 4c22409524
commit 1a7868d27f
1 changed files with 18 additions and 3 deletions

View File

@ -411,8 +411,12 @@ class TransportTest (unittest.TestCase):
schan.send('hello\n') schan.send('hello\n')
# something should be ready now # something should be ready now (give it 1 second to appear)
r, w, e = select.select([chan], [], [], 0.1) 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([chan], r)
self.assertEquals([], w) self.assertEquals([], w)
self.assertEquals([], e) self.assertEquals([], e)
@ -425,6 +429,17 @@ class TransportTest (unittest.TestCase):
self.assertEquals([], w) self.assertEquals([], w)
self.assertEquals([], e) self.assertEquals([], e)
chan.close()
schan.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()