Delint test_sftp (remove unused imports and unused variables, remove excess whitespace, move imports to top, remove semicolon terminator)
--HG-- extra : source : 01df712a396de5fa7e1c0cc265411fdb2bbc5f41
This commit is contained in:
parent
721f74d8c2
commit
3a9119d78a
|
@ -26,13 +26,10 @@ do test file operations in (so no existing files will be harmed).
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import random
|
import warnings
|
||||||
import struct
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import paramiko
|
import paramiko
|
||||||
|
@ -227,7 +224,7 @@ class SFTPTest (unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
f = sftp.open(FOLDER + '/first.txt', 'w')
|
f = sftp.open(FOLDER + '/first.txt', 'w')
|
||||||
try:
|
try:
|
||||||
f.write('content!\n');
|
f.write('content!\n')
|
||||||
f.close()
|
f.close()
|
||||||
sftp.rename(FOLDER + '/first.txt', FOLDER + '/second.txt')
|
sftp.rename(FOLDER + '/first.txt', FOLDER + '/second.txt')
|
||||||
try:
|
try:
|
||||||
|
@ -438,7 +435,7 @@ class SFTPTest (unittest.TestCase):
|
||||||
self.assertEqual(sftp.readlink(FOLDER + '/link.txt'), 'original.txt')
|
self.assertEqual(sftp.readlink(FOLDER + '/link.txt'), 'original.txt')
|
||||||
|
|
||||||
f = sftp.open(FOLDER + '/link.txt', 'r')
|
f = sftp.open(FOLDER + '/link.txt', 'r')
|
||||||
self.assertEqual(f.readlines(), [ 'original\n' ])
|
self.assertEqual(f.readlines(), ['original\n'])
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
cwd = sftp.normalize('.')
|
cwd = sftp.normalize('.')
|
||||||
|
@ -566,7 +563,6 @@ class SFTPTest (unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
verify that get/put work.
|
verify that get/put work.
|
||||||
"""
|
"""
|
||||||
import os, warnings
|
|
||||||
warnings.filterwarnings('ignore', 'tempnam.*')
|
warnings.filterwarnings('ignore', 'tempnam.*')
|
||||||
|
|
||||||
localname = os.tempnam()
|
localname = os.tempnam()
|
||||||
|
@ -631,7 +627,7 @@ class SFTPTest (unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
f = sftp.open(FOLDER + '/unusual.txt', 'wx')
|
f = sftp.open(FOLDER + '/unusual.txt', 'wx')
|
||||||
self.fail('expected exception')
|
self.fail('expected exception')
|
||||||
except IOError, x:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
sftp.unlink(FOLDER + '/unusual.txt')
|
sftp.unlink(FOLDER + '/unusual.txt')
|
||||||
|
@ -671,12 +667,12 @@ class SFTPTest (unittest.TestCase):
|
||||||
f.close()
|
f.close()
|
||||||
try:
|
try:
|
||||||
f = sftp.open(FOLDER + '/zero', 'r')
|
f = sftp.open(FOLDER + '/zero', 'r')
|
||||||
data = f.readv([(0, 12)])
|
f.readv([(0, 12)])
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = sftp.open(FOLDER + '/zero', 'r')
|
f = sftp.open(FOLDER + '/zero', 'r')
|
||||||
f.prefetch()
|
f.prefetch()
|
||||||
data = f.read(100)
|
f.read(100)
|
||||||
f.close()
|
f.close()
|
||||||
finally:
|
finally:
|
||||||
sftp.unlink(FOLDER + '/zero')
|
sftp.unlink(FOLDER + '/zero')
|
||||||
|
@ -685,7 +681,6 @@ class SFTPTest (unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
verify that get/put work without confirmation.
|
verify that get/put work without confirmation.
|
||||||
"""
|
"""
|
||||||
import os, warnings
|
|
||||||
warnings.filterwarnings('ignore', 'tempnam.*')
|
warnings.filterwarnings('ignore', 'tempnam.*')
|
||||||
|
|
||||||
localname = os.tempnam()
|
localname = os.tempnam()
|
||||||
|
@ -697,7 +692,7 @@ class SFTPTest (unittest.TestCase):
|
||||||
def progress_callback(x, y):
|
def progress_callback(x, y):
|
||||||
saved_progress.append((x, y))
|
saved_progress.append((x, y))
|
||||||
res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, False)
|
res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, False)
|
||||||
|
|
||||||
self.assertEquals(SFTPAttributes().attr, res.attr)
|
self.assertEquals(SFTPAttributes().attr, res.attr)
|
||||||
|
|
||||||
f = sftp.open(FOLDER + '/bunny.txt', 'r')
|
f = sftp.open(FOLDER + '/bunny.txt', 'r')
|
||||||
|
@ -729,4 +724,3 @@ class SFTPTest (unittest.TestCase):
|
||||||
f.close()
|
f.close()
|
||||||
finally:
|
finally:
|
||||||
sftp.remove(FOLDER + '/append.txt')
|
sftp.remove(FOLDER + '/append.txt')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue