diff options
Diffstat (limited to 'tests/test_sftp_big.py')
-rw-r--r-- | tests/test_sftp_big.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py index c1d34d7c..a53a6c3d 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 * b('x')) + kblob = (1024 * 'x') start = time.time() try: f = sftp.open('%s/hongry.txt' % FOLDER, 'w') @@ -127,7 +127,7 @@ class BigSFTPTest (unittest.TestCase): kblob = bytes().join([struct.pack('>H', n) for n in range(512)]) start = time.time() try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f = sftp.open('%s/hongry.txt' % FOLDER, 'wb') f.set_pipelined(True) for n in range(1024): f.write(kblob) @@ -141,7 +141,7 @@ class BigSFTPTest (unittest.TestCase): sys.stderr.write('%ds ' % round(end - start)) start = time.time() - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f = sftp.open('%s/hongry.txt' % FOLDER, 'rb') f.prefetch() # read on odd boundaries to make sure the bytes aren't getting scrambled @@ -167,7 +167,7 @@ class BigSFTPTest (unittest.TestCase): sftp = get_sftp() kblob = bytes().join([struct.pack('>H', n) for n in range(512)]) try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f = sftp.open('%s/hongry.txt' % FOLDER, 'wb') f.set_pipelined(True) for n in range(1024): f.write(kblob) @@ -182,7 +182,7 @@ class BigSFTPTest (unittest.TestCase): k2blob = kblob + kblob chunk = 793 for i in range(10): - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f = sftp.open('%s/hongry.txt' % FOLDER, 'rb') f.prefetch() base_offset = (512 * 1024) + 17 * random.randint(1000, 2000) offsets = [base_offset + j * chunk for j in range(100)] @@ -205,7 +205,7 @@ class BigSFTPTest (unittest.TestCase): sftp = get_sftp() kblob = bytes().join([struct.pack('>H', n) for n in range(512)]) try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f = sftp.open('%s/hongry.txt' % FOLDER, 'wb') f.set_pipelined(True) for n in range(1024): f.write(kblob) @@ -220,7 +220,7 @@ class BigSFTPTest (unittest.TestCase): k2blob = kblob + kblob chunk = 793 for i in range(10): - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f = sftp.open('%s/hongry.txt' % FOLDER, 'rb') base_offset = (512 * 1024) + 17 * random.randint(1000, 2000) # make a bunch of offsets and put them in random order offsets = [base_offset + j * chunk for j in range(100)] @@ -246,7 +246,7 @@ class BigSFTPTest (unittest.TestCase): without using it, to verify that paramiko doesn't get confused. """ sftp = get_sftp() - kblob = (1024 * b('x')) + kblob = (1024 * 'x') try: f = sftp.open('%s/hongry.txt' % FOLDER, 'w') f.set_pipelined(True) @@ -281,7 +281,7 @@ class BigSFTPTest (unittest.TestCase): sftp = get_sftp() kblob = bytes().join([struct.pack('>H', n) for n in range(512)]) try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f = sftp.open('%s/hongry.txt' % FOLDER, 'wb') f.set_pipelined(True) for n in range(1024): f.write(kblob) @@ -292,7 +292,7 @@ class BigSFTPTest (unittest.TestCase): self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f = sftp.open('%s/hongry.txt' % FOLDER, 'rb') f.prefetch() data = f.read(1024) self.assertEqual(data, kblob) @@ -320,7 +320,7 @@ class BigSFTPTest (unittest.TestCase): sftp = get_sftp() kblob = bytes().join([struct.pack('>H', n) for n in range(512)]) try: - f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f = sftp.open('%s/hongry.txt' % FOLDER, 'wb') f.set_pipelined(True) for n in range(1024): f.write(kblob) @@ -331,7 +331,7 @@ class BigSFTPTest (unittest.TestCase): self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) - f = sftp.open('%s/hongry.txt' % FOLDER, 'r') + f = sftp.open('%s/hongry.txt' % FOLDER, 'rb') data = list(f.readv([(23 * 1024, 128 * 1024)])) self.assertEqual(1, len(data)) data = data[0] @@ -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 * b('x')) + mblob = (1024 * 1024 * '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 * b('x')) + k32blob = (32 * 1024 * 'x') try: f = sftp.open('%s/hongry.txt' % FOLDER, 'w', 128 * 1024) for i in range(32): |