psutil icon indicating copy to clipboard operation
psutil copied to clipboard

Miscellaneous test fixes

Open kanavin opened this issue 3 years ago • 2 comments

Hello, these fixes come from the Yocto project. We install and run the test suite inside the qemu emulator: $ PSUTIL_DEBUG=1 python3 -m psutil.tests

and the commits are addressing the issues that we have found. Please refer to them for details.

kanavin avatar Apr 13 '22 11:04 kanavin

Could you provide the output showing the test failures on yocto?

giampaolo avatar Oct 18 '22 20:10 giampaolo

I just re-ran the tests without these patches, and with python 3.11-rc2. Here are the fails: (so it seems like not all of the original patches may be needed)


======================================================================
ERROR: psutil.tests.test_linux.TestSystemVirtualMemory.test_used
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/psutil/tests/__init__.py", line 683, in wrapper
    return fun(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_linux.py", line 270, in test_used
    if get_free_version_info() < (3, 3, 12):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_linux.py", line 204, in get_free_version_info
    return tuple(map(int, out.split()[-1].split('.')))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '17-dirty'

======================================================================
ERROR: psutil.tests.test_misc.TestMisc.test_setup_script
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_misc.py", line 259, in test_setup_script
    module = import_module_by_path(setup_py)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/psutil/tests/__init__.py", line 1686, in import_module_by_path
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1073, in get_code
  File "<frozen importlib._bootstrap_external>", line 1130, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3.11/site-packages/setup.py'

======================================================================
FAIL: psutil.tests.test_posix.TestSystemAPIs.test_disk_usage
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/psutil/tests/__init__.py", line 691, in wrapper
    raise exc
  File "/usr/lib/python3.11/site-packages/psutil/tests/__init__.py", line 683, in wrapper
    return fun(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_posix.py", line 408, in test_disk_usage
    self.assertAlmostEqual(usage.total, total, delta=tolerance)
AssertionError: 3495186432 != 2060029952 within 4194304 delta (1435156480 difference)

======================================================================
FAIL: psutil.tests.test_misc.TestCommonModule.test_debug
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_misc.py", line 437, in test_debug
    assert msg.startswith("psutil-debug"), msg
AssertionError

======================================================================
FAIL: psutil.tests.test_contracts.TestAvailProcessAPIs.test_io_counters
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/psutil/tests/test_contracts.py", line 177, in test_io_counters
    self.assertEqual(hasit, False if MACOS or SUNOS else True)
AssertionError: False != True

----------------------------------------------------------------------
Ran 635 tests in 8.295s

FAILED (failures=3, errors=2, skipped=164)
FAILED

kanavin avatar Oct 19 '22 07:10 kanavin

Closing out as outdated.

giampaolo avatar Apr 29 '25 18:04 giampaolo