summaryrefslogtreecommitdiffhomepage
path: root/tests/test_util.py
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2013-11-19 08:56:53 -0800
committerScott Maxwell <scott@codecobblers.com>2013-11-19 08:56:53 -0800
commit2da5f1fb4565d1e6dc72672f640dac44b122d235 (patch)
tree341373c292485f1417933551cc5c425d17fbbd44 /tests/test_util.py
parent7471515fffd2315f7330c5e1dd42f353982ded6c (diff)
Use 'with' for opening most file and SFTPFIle objects
Diffstat (limited to 'tests/test_util.py')
-rw-r--r--tests/test_util.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index dba52236..be107195 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -142,9 +142,8 @@ class UtilTest(ParamikoTest):
self.assertEqual(hex, '9110e2f6793b69363e58173e9436b13a5a4b339005741d5c680e505f57d871347b4239f14fb5c46e857d5e100424873ba849ac699cea98d729e57b3e84378e8b')
def test_5_host_keys(self):
- f = open('hostfile.temp', 'w')
- f.write(test_hosts_file)
- f.close()
+ with open('hostfile.temp', 'w') as f:
+ f.write(test_hosts_file)
try:
hostdict = paramiko.util.load_host_keys('hostfile.temp')
self.assertEqual(2, len(hostdict))