diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2013-10-20 07:58:57 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-10-20 07:58:57 -0400 |
commit | 249ad14dfedbe45919b48dbbff445394a64d985c (patch) | |
tree | f88f6356df0087c28e8d18a434e5e9142359352f /tests/osinfo.py | |
parent | f0459a54bb3e703691359aa3078a8234173ec361 (diff) | |
download | python-coveragepy-249ad14dfedbe45919b48dbbff445394a64d985c.tar.gz |
with statements: no more finally close
Diffstat (limited to 'tests/osinfo.py')
-rw-r--r-- | tests/osinfo.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/osinfo.py b/tests/osinfo.py index acbec23..a123123 100644 --- a/tests/osinfo.py +++ b/tests/osinfo.py @@ -44,11 +44,8 @@ elif sys.platform == 'linux2': """Read the /proc/PID/status file to find memory use.""" try: # get pseudo file /proc/<pid>/status - t = open('/proc/%d/status' % os.getpid()) - try: + with open('/proc/%d/status' % os.getpid()) as t: v = t.read() - finally: - t.close() except IOError: return 0 # non-Linux? # get VmKey line e.g. 'VmRSS: 9999 kB\n ...' |