[test] Use `with open` syntax in cwconfig "prefix" tests
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 24 Oct 2016 09:29:08 +0200
changeset 11743 48d70d143dc1
parent 11742 def9b3757945
child 11744 a6dc650bc230
[test] Use `with open` syntax in cwconfig "prefix" tests
cubicweb/test/unittest_cwconfig.py
--- a/cubicweb/test/unittest_cwconfig.py	Mon Oct 24 09:02:53 2016 +0200
+++ b/cubicweb/test/unittest_cwconfig.py	Mon Oct 24 09:29:08 2016 +0200
@@ -229,9 +229,8 @@
     def make_file(self, *args):
         self.make_dirs(*args[: -1])
         file_path = join(tempfile.tempdir, *args)
-        file_obj = open(file_path, 'w')
-        file_obj.write('""" None """')
-        file_obj.close()
+        with open(file_path, 'w') as f:
+            f.write('""" None """')
         return file_path
 
     @with_tempdir