diff options
author | Robey Pointer <robey@lag.net> | 2005-07-14 02:36:56 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-07-14 02:36:56 +0000 |
commit | 1a7868d27f2cbf996a7069f2ccc187bcddcbb7f9 (patch) | |
tree | 9201df5b0b958226ef2afd8d4ae7bd8076af2132 /tests/test_transport.py | |
parent | 4c224095243b984f754cae5ee1bc0b4771d88acc (diff) |
[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-39]
bulletproof the select test in test_transport more
Diffstat (limited to 'tests/test_transport.py')
-rw-r--r-- | tests/test_transport.py | 21 |
1 files changed, 18 insertions, 3 deletions
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() |