summaryrefslogtreecommitdiffhomepage
path: root/tests/test_hostkeys.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_hostkeys.py
parent7471515fffd2315f7330c5e1dd42f353982ded6c (diff)
Use 'with' for opening most file and SFTPFIle objects
Diffstat (limited to 'tests/test_hostkeys.py')
-rw-r--r--tests/test_hostkeys.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/test_hostkeys.py b/tests/test_hostkeys.py
index a7621d8b..5290a4dc 100644
--- a/tests/test_hostkeys.py
+++ b/tests/test_hostkeys.py
@@ -56,9 +56,8 @@ Ngw3qIch/WgRmMHy4kBq1SsXMjQCte1So6HBMvBPIW5SiMTmjCfZZiw4AYHK+B/JaOwaG9yRg2Ejg\
class HostKeysTest (unittest.TestCase):
def setUp(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)
def tearDown(self):
os.unlink('hostfile.temp')