[Python-modules-commits] [python-pyld] 178/276: Open file before	read.
    Wolfgang Borgert 
    debacle at moszumanska.debian.org
       
    Wed Oct  8 23:48:08 UTC 2014
    
    
  
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository python-pyld.
commit 896fb8cd92df56ab8d0f092fffa37322d0aac4c1
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Mon Sep 9 23:35:44 2013 -0400
    Open file before read.
---
 tests/runtests.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/runtests.py b/tests/runtests.py
index d9524c5..88b1ca7 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -212,10 +212,11 @@ def read_json(filename):
 
 
 def read_file(filename):
-    if sys.version_info.major >= 3:
-        return f.read()
-    else:
-        return  f.read().decode('utf8')
+    with open(filename) as f:
+        if sys.version_info.major >= 3:
+            return f.read()
+        else:
+            return  f.read().decode('utf8')
 
 
 def read_test_url(property):
-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git
    
    
More information about the Python-modules-commits
mailing list