summaryrefslogtreecommitdiffhomepage
path: root/tests/test_buffered_pipe.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-09-06 16:07:24 -0700
committerJeff Forcier <jeff@bitprophet.org>2014-09-06 16:07:24 -0700
commit08239ff4b29c0b53c5443f21ae482e51340223f6 (patch)
tree73f0b7e4d25a80c965186d03abde9c006b1feec0 /tests/test_buffered_pipe.py
parent5335d9dc0a6266217d288e7aaf2091739980d841 (diff)
parent6a6ac4d78421667b810f5e3a017fb669853133f9 (diff)
Merge branch 'master' into 234-int
Diffstat (limited to 'tests/test_buffered_pipe.py')
-rw-r--r--tests/test_buffered_pipe.py44
1 files changed, 21 insertions, 23 deletions
diff --git a/tests/test_buffered_pipe.py b/tests/test_buffered_pipe.py
index 47ece936..a53081a9 100644
--- a/tests/test_buffered_pipe.py
+++ b/tests/test_buffered_pipe.py
@@ -22,61 +22,60 @@ Some unit tests for BufferedPipe.
import threading
import time
-import unittest
from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
from paramiko import pipe
-from util import ParamikoTest
+from tests.util import ParamikoTest
-def delay_thread(pipe):
- pipe.feed('a')
+def delay_thread(p):
+ p.feed('a')
time.sleep(0.5)
- pipe.feed('b')
- pipe.close()
+ p.feed('b')
+ p.close()
-def close_thread(pipe):
+def close_thread(p):
time.sleep(0.2)
- pipe.close()
+ p.close()
class BufferedPipeTest(ParamikoTest):
def test_1_buffered_pipe(self):
p = BufferedPipe()
- self.assert_(not p.read_ready())
+ self.assertTrue(not p.read_ready())
p.feed('hello.')
- self.assert_(p.read_ready())
+ self.assertTrue(p.read_ready())
data = p.read(6)
- self.assertEquals('hello.', data)
+ self.assertEqual(b'hello.', data)
p.feed('plus/minus')
- self.assertEquals('plu', p.read(3))
- self.assertEquals('s/m', p.read(3))
- self.assertEquals('inus', p.read(4))
+ self.assertEqual(b'plu', p.read(3))
+ self.assertEqual(b's/m', p.read(3))
+ self.assertEqual(b'inus', p.read(4))
p.close()
- self.assert_(not p.read_ready())
- self.assertEquals('', p.read(1))
+ self.assertTrue(not p.read_ready())
+ self.assertEqual(b'', p.read(1))
def test_2_delay(self):
p = BufferedPipe()
- self.assert_(not p.read_ready())
+ self.assertTrue(not p.read_ready())
threading.Thread(target=delay_thread, args=(p,)).start()
- self.assertEquals('a', p.read(1, 0.1))
+ self.assertEqual(b'a', p.read(1, 0.1))
try:
p.read(1, 0.1)
- self.assert_(False)
+ self.assertTrue(False)
except PipeTimeout:
pass
- self.assertEquals('b', p.read(1, 1.0))
- self.assertEquals('', p.read(1))
+ self.assertEqual(b'b', p.read(1, 1.0))
+ self.assertEqual(b'', p.read(1))
def test_3_close_while_reading(self):
p = BufferedPipe()
threading.Thread(target=close_thread, args=(p,)).start()
data = p.read(1, 1.0)
- self.assertEquals('', data)
+ self.assertEqual(b'', data)
def test_4_or_pipe(self):
p = pipe.make_pipe()
@@ -90,4 +89,3 @@ class BufferedPipeTest(ParamikoTest):
self.assertTrue(p._set)
p2.clear()
self.assertFalse(p._set)
-