Bug 870575 - Upgrade psutil to 0.7.1; rs=me

Archive obtained from
https://psutil.googlecode.com/files/psutil-0.7.1.tar.gz and checked in
with no modifications.
This commit is contained in:
Gregory Szorc
2013-05-09 15:39:30 -07:00
parent 1cc151bb41
commit b6b2528c1b
57 changed files with 2096 additions and 1296 deletions

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env python
#
# $Id: _linux.py 1498 2012-07-24 21:41:28Z g.rodola $
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -14,6 +12,7 @@ import subprocess
import sys
import time
import os
import re
from test_psutil import sh, get_test_subprocess
from psutil._compat import PY3
@@ -115,6 +114,26 @@ class LinuxSpecificTestCase(unittest.TestCase):
free = int(lines[2].split()[3]) * 1024
self.assert_eq_w_tol(free, psutil.swap_memory().free, TOLERANCE)
def test_cpu_times(self):
fields = psutil.cpu_times()._fields
kernel_ver = re.findall('\d.\d.\d', os.uname()[2])[0]
kernel_ver_info = tuple(map(int, kernel_ver.split('.')))
# steal >= 2.6.11
# guest >= 2.6.24
# guest_nice >= 3.2.0
if kernel_ver_info >= (2, 6, 11):
assert 'steal' in fields, fields
else:
assert 'steal' not in fields, fields
if kernel_ver_info >= (2, 6, 24):
assert 'guest' in fields, fields
else:
assert 'guest' not in fields, fields
if kernel_ver_info >= (3, 2, 0):
assert 'guest_nice' in fields, fields
else:
assert 'guest_nice' not in fields, fields
if __name__ == '__main__':
test_suite = unittest.TestSuite()