[web/test] open() as a context manager
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 08 Feb 2016 15:29:06 +0100
changeset 11156 36252a0c76ec
parent 11155 3bc47295c262
child 11157 42fa15632493
[web/test] open() as a context manager
cubicweb/web/test/unittest_web.py
--- a/cubicweb/web/test/unittest_web.py	Mon Feb 08 15:28:14 2016 +0100
+++ b/cubicweb/web/test/unittest_web.py	Mon Feb 08 15:29:06 2016 +0100
@@ -72,7 +72,8 @@
         return open(join(self.datadir, fname), 'rb')
 
     def _fcontent(self, fname):
-        return self._fobject(fname).read()
+        with self._fobject(fname) as f:
+            return f.read()
 
     def test_single_file_upload(self):
         files = {'file': ('schema.py', self._fobject('schema.py'))}