summaryrefslogtreecommitdiff
path: root/tests/osinfo.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-12-13 22:45:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2013-12-13 22:45:10 -0500
commit2df9b1c35cbb5c92204fc5923368a3d619a34f6d (patch)
treed1ede8ffef812ba4e345b08f698f001ebe69cb56 /tests/osinfo.py
parent84221611890880b749dbb650e8d07ac8918dba46 (diff)
parent7c66441eab3af17539c478a2cb4e19cd93ba0cf4 (diff)
downloadpython-coveragepy-git-2df9b1c35cbb5c92204fc5923368a3d619a34f6d.tar.gz
Merged 4.0 to default
Diffstat (limited to 'tests/osinfo.py')
-rw-r--r--tests/osinfo.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/osinfo.py b/tests/osinfo.py
index 25c3a7c6..a123123c 100644
--- a/tests/osinfo.py
+++ b/tests/osinfo.py
@@ -2,7 +2,7 @@
import sys
-if sys.version_info >= (2, 5) and sys.platform == 'win32':
+if sys.platform == 'win32':
# Windows implementation
def process_ram():
"""How much RAM is this process using? (Windows)"""
@@ -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 ...'