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 binascii import hexlify
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import struct
|
||||
import warnings
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import paramiko
|
||||
|
@ -227,7 +224,7 @@ class SFTPTest (unittest.TestCase):
|
|||
"""
|
||||
f = sftp.open(FOLDER + '/first.txt', 'w')
|
||||
try:
|
||||
f.write('content!\n');
|
||||
f.write('content!\n')
|
||||
f.close()
|
||||
sftp.rename(FOLDER + '/first.txt', FOLDER + '/second.txt')
|
||||
try:
|
||||
|
@ -438,7 +435,7 @@ class SFTPTest (unittest.TestCase):
|
|||
self.assertEqual(sftp.readlink(FOLDER + '/link.txt'), 'original.txt')
|
||||
|
||||
f = sftp.open(FOLDER + '/link.txt', 'r')
|
||||
self.assertEqual(f.readlines(), [ 'original\n' ])
|
||||
self.assertEqual(f.readlines(), ['original\n'])
|
||||
f.close()
|
||||
|
||||
cwd = sftp.normalize('.')
|
||||
|
@ -566,7 +563,6 @@ class SFTPTest (unittest.TestCase):
|
|||
"""
|
||||
verify that get/put work.
|
||||
"""
|
||||
import os, warnings
|
||||
warnings.filterwarnings('ignore', 'tempnam.*')
|
||||
|
||||
localname = os.tempnam()
|
||||
|
@ -631,7 +627,7 @@ class SFTPTest (unittest.TestCase):
|
|||
try:
|
||||
f = sftp.open(FOLDER + '/unusual.txt', 'wx')
|
||||
self.fail('expected exception')
|
||||
except IOError, x:
|
||||
except IOError:
|
||||
pass
|
||||
finally:
|
||||
sftp.unlink(FOLDER + '/unusual.txt')
|
||||
|
@ -671,12 +667,12 @@ class SFTPTest (unittest.TestCase):
|
|||
f.close()
|
||||
try:
|
||||
f = sftp.open(FOLDER + '/zero', 'r')
|
||||
data = f.readv([(0, 12)])
|
||||
f.readv([(0, 12)])
|
||||
f.close()
|
||||
|
||||
f = sftp.open(FOLDER + '/zero', 'r')
|
||||
f.prefetch()
|
||||
data = f.read(100)
|
||||
f.read(100)
|
||||
f.close()
|
||||
finally:
|
||||
sftp.unlink(FOLDER + '/zero')
|
||||
|
@ -685,7 +681,6 @@ class SFTPTest (unittest.TestCase):
|
|||
"""
|
||||
verify that get/put work without confirmation.
|
||||
"""
|
||||
import os, warnings
|
||||
warnings.filterwarnings('ignore', 'tempnam.*')
|
||||
|
||||
localname = os.tempnam()
|
||||
|
@ -729,4 +724,3 @@ class SFTPTest (unittest.TestCase):
|
|||
f.close()
|
||||
finally:
|
||||
sftp.remove(FOLDER + '/append.txt')
|
||||
|
||||
|
|
Loading…
Reference in New Issue