giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.39k forks source link

test suite failures #1226

Open themaddoctor opened 6 years ago

themaddoctor commented 6 years ago

With psutil 5.4.3 and python 2.7.13 and gcc 7.3.0, I am getting these errors when doing "python2 setup.py test":

======================================================================
ERROR: psutil.tests.test_posix.TestSystemAPIs.test_users
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/__init__.py", line 623, in wrapper
    return fun(*args, **kwargs)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_posix.py", line 341, in test_users
    users = [x.split()[0] for x in lines]
IndexError: list index out of range

======================================================================
ERROR: psutil.tests.test_linux.TestSystemVirtualMemory.test_avail_old_missing_fields
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_linux.py", line 363, in test_avail_old_missing_fields
    w = ws[0]
IndexError: list index out of range

======================================================================
ERROR: psutil.tests.test_linux.TestSystemVirtualMemory.test_avail_old_missing_zoneinfo
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_linux.py", line 398, in test_avail_old_missing_zoneinfo
    w = ws[0]
IndexError: list index out of range

======================================================================
FAIL: psutil.tests.test_misc.TestScripts.test_who
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_misc.py", line 715, in test_who
    self.assert_stdout('who.py')
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_misc.py", line 667, in assert_stdout
    assert out, out
AssertionError

======================================================================
FAIL: psutil.tests.test_process.TestProcess.test_environ
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_process.py", line 1419, in test_environ
    self.assertEqual(d1, d2)
AssertionError: {'HZ': '100', 'BASH_FUNC_pathprepend%%': '() {  pathremove $1 $2;\n local PATHVA [truncated]... != {'HZ': '100', 'BASH_FUNC_pathprepend%%': '() {  pathremove $1 $2;\n local PATHVA [truncated]...
  {'BASH_FUNC_pathappend%%': '() {  pathremove $1 $2;\n local PATHVARIABLE=${2:-PATH};\n export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"\n}',
   'BASH_FUNC_pathprepend%%': '() {  pathremove $1 $2;\n local PATHVARIABLE=${2:-PATH};\n export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"\n}',
   'BASH_FUNC_pathremove%%': '() {  local IFS=\':\';\n local NEWPATH;\n local DIR;\n local PATHVARIABLE=${2:-PATH};\n for DIR in ${!PATHVARIABLE};\n do\n if [ "$DIR" != "$1" ]; then\n NEWPATH=${NEWPATH:+$NEWPATH:}$DIR;\n fi;\n done;\n export $PATHVARIABLE="$NEWPATH"\n}',
   'COLORTERM': '',
   'DISPLAY': ':0',
   'HISTIGNORE': '&:[bf]g:exit',
   'HISTSIZE': '1000',
   'HZ': '100',
   'INFOPATH': '/usr/share/info',
   'INPUTRC': '/etc/inputrc',
   'LANG': 'en_US.UTF-8',
   'LC_ALL': 'en_US.UTF-8',
   'LOGNAME': 'root',
   'LS_COLORS': 'no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=00;35:do=00;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=00;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.xz=01;31:*.jpg=00;35:*.jpeg=00;35:*.gif=00;35:*.bmp=00;35:*.pbm=00;35:*.pgm=00;35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.tiff=00;35:*.png=00;35:*.mpg=00;35:*.mpeg=00;35:*.avi=00;35:*.fli=00;35:*.gl=00;35:*.dl=00;35:*.xcf=00;35:*.xwd=00;35:*.ogg=00;35:*.mp3=00;35:*.wav=00;35:',
   'MAIL': '/var/mail/root',
   'MANPATH': '/usr/share/man',
   'OLDPWD': '/building/calibre',
   'PATH': '/bin:/usr/bin:/sbin:/usr/sbin',
   'PS1': '\\u \\W > ',
   'PWD': '/building/calibre/psutil-5.4.3',
+  'PYTHONPATH': '/home/building/calibre/psutil-5.4.3:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages',
   'QT4DIR': '/usr',
   'QT5DIR': '/usr',
   'QTDIR': '/usr',
   'SHELL': '/bin/bash',
   'SHLVL': '1',
   'TERM': 'xterm',
   'USER': 'root',
   'XDG_CONFIG_DIRS': '/etc/xdg/',
   'XDG_DATA_DIRS': '/usr/share/',
   'XDG_RUNTIME_DIR': '/tmp/xdg-root',
   '_': '/usr/bin/python2'}

======================================================================
FAIL: psutil.tests.test_linux.TestSystemCPUStats.test_ctx_switches
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_linux.py", line 735, in test_ctx_switches
    self.assertAlmostEqual(vmstat_value, psutil_value, delta=500)
AssertionError: 4216416761 != 21396285949 within 500 delta

======================================================================
FAIL: psutil.tests.test_linux.TestSystemCPUStats.test_interrupts
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_linux.py", line 741, in test_interrupts
    self.assertAlmostEqual(vmstat_value, psutil_value, delta=500)
AssertionError: 4114915867 != 8409883163 within 500 delta

======================================================================
FAIL: psutil.tests.test_linux.TestSystemNetwork.test_net_if_names
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_linux.py", line 826, in test_net_if_names
    self.assertIn(name, nics)
AssertionError: 'sit0@NONE' not found in ['sit0', 'lo', 'wlan0', 'eth0']

======================================================================
FAIL: psutil.tests.test_system.TestSystemAPIs.test_users
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_system.py", line 723, in test_users
    self.assertNotEqual(users, [])
AssertionError: [] == []

======================================================================
FAIL: psutil.tests.test_contracts.TestFetchAllProcesses.test_fetch_all
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_contracts.py", line 364, in test_fetch_all
    meth(ret, p)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/test_contracts.py", line 448, in status
    self.assertNotEqual(ret, '?')  # XXX
AssertionError: '?' == '?'

----------------------------------------------------------------------
Ran 583 tests in 5.370s

FAILED (failures=7, errors=3, skipped=156)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/__init__.py", line 230, in _cleanup_procs
    reap_children(recursive=True)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/__init__.py", line 471, in reap_children
    children = set(psutil.Process().children(recursive=True))
  File "/home/building/calibre/psutil-5.4.3/psutil/__init__.py", line 341, in __init__
    self._init(pid)
  File "/home/building/calibre/psutil-5.4.3/psutil/__init__.py", line 363, in _init
    self._proc = _psplatform.Process(pid)
  File "/home/building/calibre/psutil-5.4.3/psutil/_pslinux.py", line 1417, in __init__
    self._procfs_path = get_procfs_path()
  File "/home/building/calibre/psutil-5.4.3/psutil/_pslinux.py", line 214, in get_procfs_path
    return sys.modules['psutil'].PROCFS_PATH
KeyError: 'psutil'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/__init__.py", line 230, in _cleanup_procs
    reap_children(recursive=True)
  File "/home/building/calibre/psutil-5.4.3/psutil/tests/__init__.py", line 471, in reap_children
    children = set(psutil.Process().children(recursive=True))
  File "/home/building/calibre/psutil-5.4.3/psutil/__init__.py", line 341, in __init__
    self._init(pid)
  File "/home/building/calibre/psutil-5.4.3/psutil/__init__.py", line 363, in _init
    self._proc = _psplatform.Process(pid)
  File "/home/building/calibre/psutil-5.4.3/psutil/_pslinux.py", line 1417, in __init__
    self._procfs_path = get_procfs_path()
  File "/home/building/calibre/psutil-5.4.3/psutil/_pslinux.py", line 214, in get_procfs_path
    return sys.modules['psutil'].PROCFS_PATH
KeyError: 'psutil'
themaddoctor commented 6 years ago

Not sure if I should be concerned.

giampaolo commented 6 years ago

Sorry for the huge delay. Do you still know / remember what Linux distro was this? Those are weird errors.

giampaolo commented 6 years ago

Also, if you can you should re-run tests with latest psutil version (or git master, even better).

themaddoctor commented 6 years ago

It was a LFS built from recent sources.

giampaolo commented 6 years ago

Those sources changed. We're at 5.4.7, you were at 5.4.3.