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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user