summaryrefslogtreecommitdiff
path: root/test/osinfo.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-01-30 11:49:52 -0500
committerNed Batchelder <ned@nedbatchelder.com>2011-01-30 11:49:52 -0500
commit16943d29886df91300121fced970134d0c2b9806 (patch)
tree0e621681a8c90b7c7e3dabcaa0b241693129846b /test/osinfo.py
parentfefc80883476d3974b3aee692ab274d1f563f7bb (diff)
downloadpython-coveragepy-git-16943d29886df91300121fced970134d0c2b9806.tar.gz
A bunch more places where a file close should be in a finally clause.
Diffstat (limited to 'test/osinfo.py')
-rw-r--r--test/osinfo.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/osinfo.py b/test/osinfo.py
index 04855fe6..25c3a7c6 100644
--- a/test/osinfo.py
+++ b/test/osinfo.py
@@ -45,8 +45,10 @@ elif sys.platform == 'linux2':
try:
# get pseudo file /proc/<pid>/status
t = open('/proc/%d/status' % os.getpid())
- v = t.read()
- t.close()
+ try:
+ v = t.read()
+ finally:
+ t.close()
except IOError:
return 0 # non-Linux?
# get VmKey line e.g. 'VmRSS: 9999 kB\n ...'