summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2013-11-01 09:49:52 -0700
committerScott Maxwell <scott@codecobblers.com>2013-11-01 09:49:52 -0700
commit9662a7f779636f0328263a81cdeb76af25802970 (patch)
tree0d0caa288159db9439e22039b21127201fc09017 /tests
parent06b866cf406c035ecaffd7a8abd31d6e07b8811a (diff)
Changes inspired by the nischu7 branch
Diffstat (limited to 'tests')
-rw-r--r--tests/loop.py2
-rw-r--r--tests/test_client.py12
-rwxr-xr-xtests/test_sftp.py6
-rw-r--r--tests/test_sftp_big.py8
4 files changed, 17 insertions, 11 deletions
diff --git a/tests/loop.py b/tests/loop.py
index b2c73ddf..6e933f83 100644
--- a/tests/loop.py
+++ b/tests/loop.py
@@ -59,7 +59,7 @@ class LoopSocket (object):
try:
if self.__mate is None:
# EOF
- return ''
+ return bytes()
if len(self.__in_buffer) == 0:
self.__cv.wait(self.__timeout)
if len(self.__in_buffer) == 0:
diff --git a/tests/test_client.py b/tests/test_client.py
index a8d04630..e6d10699 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -207,8 +207,14 @@ class SSHClientTest (unittest.TestCase):
self.assert_(p() is not None)
del self.tc
# hrm, sometimes p isn't cleared right away. why is that?
- st = time.time()
- while (time.time() - st < 5.0) and (p() is not None):
- time.sleep(0.1)
+ #st = time.time()
+ #while (time.time() - st < 5.0) and (p() is not None):
+ # time.sleep(0.1)
+
+ # instead of dumbly waiting for the GC to collect, force a collection
+ # to see whether the SSHClient object is deallocated correctly
+ import gc
+ gc.collect()
+
self.assert_(p() is None)
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 460e04cf..20f68d8a 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -611,12 +611,12 @@ class SFTPTest (unittest.TestCase):
try:
f = sftp.open(FOLDER + '/kitty.txt', 'r')
sum = f.check('sha1')
- self.assertEqual('91059CFC6615941378D413CB5ADAF4C5EB293402', hexlify(sum).upper())
+ self.assertEqual('91059CFC6615941378D413CB5ADAF4C5EB293402', u(hexlify(sum)).upper())
sum = f.check('md5', 0, 512)
- self.assertEqual('93DE4788FCA28D471516963A1FE3856A', hexlify(sum).upper())
+ self.assertEqual('93DE4788FCA28D471516963A1FE3856A', u(hexlify(sum)).upper())
sum = f.check('md5', 0, 0, 510)
self.assertEqual('EB3B45B8CD55A0707D99B177544A319F373183D241432BB2157AB9E46358C4AC90370B5CADE5D90336FC1716F90B36D6',
- hexlify(sum).upper())
+ u(hexlify(sum)).upper())
f.close()
finally:
sftp.unlink(FOLDER + '/kitty.txt')
diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py
index b7ffe0b5..c1d34d7c 100644
--- a/tests/test_sftp_big.py
+++ b/tests/test_sftp_big.py
@@ -92,7 +92,7 @@ class BigSFTPTest (unittest.TestCase):
write a 1MB file with no buffering.
"""
sftp = get_sftp()
- kblob = (1024 * 'x')
+ kblob = (1024 * b('x'))
start = time.time()
try:
f = sftp.open('%s/hongry.txt' % FOLDER, 'w')
@@ -246,7 +246,7 @@ class BigSFTPTest (unittest.TestCase):
without using it, to verify that paramiko doesn't get confused.
"""
sftp = get_sftp()
- kblob = (1024 * 'x')
+ kblob = (1024 * b('x'))
try:
f = sftp.open('%s/hongry.txt' % FOLDER, 'w')
f.set_pipelined(True)
@@ -347,7 +347,7 @@ class BigSFTPTest (unittest.TestCase):
write a 1MB file, with no linefeeds, and a big buffer.
"""
sftp = get_sftp()
- mblob = (1024 * 1024 * 'x')
+ mblob = (1024 * 1024 * b('x'))
try:
f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024)
f.write(mblob)
@@ -364,7 +364,7 @@ class BigSFTPTest (unittest.TestCase):
sftp = get_sftp()
t = sftp.sock.get_transport()
t.packetizer.REKEY_BYTES = 512 * 1024
- k32blob = (32 * 1024 * 'x')
+ k32blob = (32 * 1024 * b('x'))
try:
f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024)
for i in range(32):