From 2da5f1fb4565d1e6dc72672f640dac44b122d235 Mon Sep 17 00:00:00 2001 From: Scott Maxwell Date: Tue, 19 Nov 2013 08:56:53 -0800 Subject: Use 'with' for opening most file and SFTPFIle objects --- tests/test_util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/test_util.py') 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)) -- cgit v1.2.3