Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] 5.9.8: pytest is failing with pytest 8.2.1 #2043

Open
kloczek opened this issue Jan 2, 2022 · 8 comments
Open

[Linux] 5.9.8: pytest is failing with pytest 8.2.1 #2043

kloczek opened this issue Jan 2, 2022 · 8 comments

Comments

@kloczek
Copy link

kloczek commented Jan 2, 2022

Summary

  • OS: Linux
  • Architecture: 64bit
  • Psutil version: N/A
  • Python version: 3.8.12
  • Type: tests

Description

I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly --import-mode=importlib
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.0
collected 654 items

psutil/tests/test_aix.py sssss                                                                                                                                       [  0%]
psutil/tests/test_bsd.py sssssssssssssssssssssssssssssssssssssssssssssss                                                                                             [  7%]
psutil/tests/test_connections.py .................                                                                                                                   [ 10%]
psutil/tests/test_contracts.py ........................................                                                                                              [ 16%]
psutil/tests/test_linux.py ...................................FF.F...............F.FF........sssssssss..................................                             [ 33%]
psutil/tests/test_memleaks.py .......................s...s.......s.......................s...s.......sss..........s..............                                    [ 48%]
psutil/tests/test_misc.py ....F.............F...................ssssssssssssssssssssssss                                                                             [ 57%]
psutil/tests/test_osx.py ssssssssssssss                                                                                                                              [ 60%]
psutil/tests/test_posix.py ......................F.                                                                                                                  [ 63%]
psutil/tests/test_process.py .......................s.............s.........................F.................                                                       [ 76%]
psutil/tests/test_sunos.py ss                                                                                                                                        [ 76%]
psutil/tests/test_system.py .........F....................F..s......s...                                                                                             [ 83%]
psutil/tests/test_testutils.py .................................                                                                                                     [ 88%]
psutil/tests/test_unicode.py ...................                                                                                                                     [ 91%]
psutil/tests/test_windows.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                                              [100%]

================================================================================= FAILURES =================================================================================
___________________________________________________________________ TestSystemCPUStats.test_ctx_switches ___________________________________________________________________

self = <test_linux.TestSystemCPUStats testMethod=test_ctx_switches>

    def test_ctx_switches(self):
        vmstat_value = vmstat("context switches")
        psutil_value = psutil.cpu_stats().ctx_switches
>       self.assertAlmostEqual(vmstat_value, psutil_value, delta=500)
E       AssertionError: 639746777 != 9229681375 within 500 delta (8589934598 difference)

psutil/tests/test_linux.py:902: AssertionError
____________________________________________________________________ TestSystemCPUStats.test_interrupts ____________________________________________________________________

self = <test_linux.TestSystemCPUStats testMethod=test_interrupts>

    def test_interrupts(self):
        vmstat_value = vmstat("interrupts")
        psutil_value = psutil.cpu_stats().interrupts
>       self.assertAlmostEqual(vmstat_value, psutil_value, delta=500)
E       AssertionError: 1193337845 != 5488305146 within 500 delta (4294967301 difference)

psutil/tests/test_linux.py:907: AssertionError
______________________________________________________________________ TestSystemNetIfAddrs.test_ips _______________________________________________________________________

self = <test_linux.TestSystemNetIfAddrs testMethod=test_ips>

    def test_ips(self):
        for name, addrs in psutil.net_if_addrs().items():
            for addr in addrs:
                if addr.family == psutil.AF_LINK:
                    self.assertEqual(addr.address, get_mac_address(name))
                elif addr.family == socket.AF_INET:
                    self.assertEqual(addr.address, get_ipv4_address(name))
                    self.assertEqual(addr.netmask, get_ipv4_netmask(name))
                    if addr.broadcast is not None:
                        self.assertEqual(addr.broadcast,
                                         get_ipv4_broadcast(name))
                    else:
                        self.assertEqual(get_ipv4_broadcast(name), '0.0.0.0')
                elif addr.family == socket.AF_INET6:
                    # IPv6 addresses can have a percent symbol at the end.
                    # E.g. these 2 are equivalent:
                    # "fe80::1ff:fe23:4567:890a"
                    # "fe80::1ff:fe23:4567:890a%eth0"
                    # That is the "zone id" portion, which usually is the name
                    # of the network interface.
                    address = addr.address.split('%')[0]
>                   self.assertEqual(address, get_ipv6_address(name))
E                   AssertionError: '2a02:c7e:38c1:5f00:435e:4504:93a5:3025' != 'fdab:c99a:a0f7:1:85f2:ba2b:e617:996b'
E                   - 2a02:c7e:38c1:5f00:435e:4504:93a5:3025
E                   + fdab:c99a:a0f7:1:85f2:ba2b:e617:996b

psutil/tests/test_linux.py:953: AssertionError
_______________________________________________________________ TestRootFsDeviceFinder.test_against_findmnt ________________________________________________________________

self = <test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme1n1p2[/root]'

psutil/tests/test_linux.py:1317: AssertionError
_________________________________________________________________ TestRootFsDeviceFinder.test_comparisons __________________________________________________________________

self = <test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1294: AssertionError
____________________________________________________________ TestRootFsDeviceFinder.test_disk_partitions_mocked ____________________________________________________________

self = <test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
        with mock.patch(
                'psutil._pslinux.cext.disk_partitions',
                return_value=[('/dev/root', '/', 'ext4', 'rw')]) as m:
            part = psutil.disk_partitions()[0]
            assert m.called
            if not GITHUB_ACTIONS:
>               self.assertNotEqual(part.device, "/dev/root")
E               AssertionError: '/dev/root' == '/dev/root'

psutil/tests/test_linux.py:1326: AssertionError
___________________________________________________________________________ TestMisc.test_debug ____________________________________________________________________________

self = <test_misc.TestMisc testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError:
E       assert False
E        +  where False = <built-in method startswith of str object at 0x7f182ccd52f0>('psutil-debug')
E        +    where <built-in method startswith of str object at 0x7f182ccd52f0> = ''.startswith

psutil/tests/test_misc.py:413: AssertionError
________________________________________________________________________ TestMisc.test_setup_script ________________________________________________________________________

self = <test_misc.TestMisc testMethod=test_setup_script>

    @unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
    def test_setup_script(self):
        setup_py = os.path.join(ROOT_DIR, 'setup.py')
        if CI_TESTING and not os.path.exists(setup_py):
            return self.skipTest("can't find setup.py")
>       module = import_module_by_path(setup_py)

psutil/tests/test_misc.py:375:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:1684: in import_module_by_path
    spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:839: in exec_module
    ???
<frozen importlib._bootstrap_external>:975: in get_code
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_frozen_importlib_external.SourceFileLoader object at 0x7f182b11f610>
path = '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/setup.py'

>   ???
E   FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/setup.py'

<frozen importlib._bootstrap_external>:1032: FileNotFoundError
________________________________________________________________________ TestSystemAPIs.test_users _________________________________________________________________________

self = <test_posix.TestSystemAPIs testMethod=test_users>

    @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
    @retry_on_failure()
    def test_users(self):
        out = sh("who")
        if not out.strip():
            raise self.skipTest("no users on this system")
        lines = out.split('\n')
        users = [x.split()[0] for x in lines]
        terminals = [x.split()[1] for x in lines]
>       self.assertEqual(len(users), len(psutil.users()))
E       AssertionError: 10 != 11

psutil/tests/test_posix.py:338: AssertionError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
AssertionError('10 != 11'), retrying
________________________________________________________________________ TestProcess.test_terminal _________________________________________________________________________

self = <test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:301: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = 'tty', kwds = {'creationflags': 0, 'shell': True, 'stderr': -1, 'stdout': -1, ...}, shell = True, flags = 0, p = <subprocess.Popen object at 0x7f18294ca850>
stdout = 'not a tty\n', stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        shell = True if isinstance(cmd, (str, unicode)) else False
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS and shell else 0
        kwds.setdefault("shell", shell)
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:472: RuntimeError
_________________________________________________________________________ TestMiscAPIs.test_users __________________________________________________________________________

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>

    @functools.wraps(fun)
    def wrapper(self):
        try:
            # case 1: we previously entered oneshot() ctx
>           ret = self._cache[fun]
E           AttributeError: _cache

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_common.py:441: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>, args = (), kwargs = {}

    @functools.wraps(fun)
    def wrapper(self, *args, **kwargs):
        try:
>           return fun(self, *args, **kwargs)

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_pslinux.py:1661:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>

    @functools.wraps(fun)
    def wrapper(self):
        try:
            # case 1: we previously entered oneshot() ctx
            ret = self._cache[fun]
        except AttributeError:
            # case 2: we never entered oneshot() ctx
>           return fun(self)

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_common.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>

    @wrap_exceptions
    @memoize_when_activated
    def _parse_stat_file(self):
        """Parse /proc/{pid}/stat file and return a dict with various
        process info.
        Using "man proc" as a reference: where "man proc" refers to
        position N always substract 3 (e.g ppid position 4 in
        'man proc' == position 1 in here).
        The return value is cached in case oneshot() ctx manager is
        in use.
        """
>       with open_binary("%s/%s/stat" % (self._procfs_path, self.pid)) as f:

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_pslinux.py:1703:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fname = '/proc/1100/stat', kwargs = {}

    def open_binary(fname, **kwargs):
>       return open(fname, "rb", **kwargs)
E       FileNotFoundError: [Errno 2] No such file or directory: '/proc/1100/stat'

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_common.py:711: FileNotFoundError

During handling of the above exception, another exception occurred:

self = psutil.Process(pid=1100, status='terminated'), pid = 1100, _ignore_nsp = False

    def _init(self, pid, _ignore_nsp=False):
        if pid is None:
            pid = os.getpid()
        else:
            if not _PY3 and not isinstance(pid, (int, long)):
                raise TypeError('pid must be an integer (got %r)' % pid)
            if pid < 0:
                raise ValueError('pid must be a positive integer (got %s)'
                                 % pid)
        self._pid = pid
        self._name = None
        self._exe = None
        self._create_time = None
        self._gone = False
        self._pid_reused = False
        self._hash = None
        self._lock = threading.RLock()
        # used for caching on Windows only (on POSIX ppid may change)
        self._ppid = None
        # platform-specific modules define an _psplatform.Process
        # implementation class
        self._proc = _psplatform.Process(pid)
        self._last_sys_cpu_times = None
        self._last_proc_cpu_times = None
        self._exitcode = _SENTINEL
        # cache creation time for later use in is_running() method
        try:
>           self.create_time()

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/__init__.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = psutil.Process(pid=1100, status='terminated')

    def create_time(self):
        """The process creation time as a floating point number
        expressed in seconds since the epoch.
        The return value is cached after first call.
        """
        if self._create_time is None:
>           self._create_time = self._proc.create_time()

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/__init__.py:717:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>, args = (), kwargs = {}

    @functools.wraps(fun)
    def wrapper(self, *args, **kwargs):
        try:
>           return fun(self, *args, **kwargs)

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_pslinux.py:1661:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>

    @wrap_exceptions
    def create_time(self):
>       ctime = float(self._parse_stat_file()['create_time'])

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_pslinux.py:1873:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <psutil._pslinux.Process object at 0x7f1828f2dae0>, args = (), kwargs = {}

    @functools.wraps(fun)
    def wrapper(self, *args, **kwargs):
        try:
            return fun(self, *args, **kwargs)
        except PermissionError:
            raise AccessDenied(self.pid, self._name)
        except ProcessLookupError:
            raise NoSuchProcess(self.pid, self._name)
        except FileNotFoundError:
            if not os.path.exists("%s/%s" % (self._procfs_path, self.pid)):
>               raise NoSuchProcess(self.pid, self._name)
E               psutil.NoSuchProcess: process no longer exists (pid=1100)

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/_pslinux.py:1668: NoSuchProcess

During handling of the above exception, another exception occurred:

self = <test_system.TestMiscAPIs testMethod=test_users>

    @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
    def test_users(self):
        users = psutil.users()
        self.assertNotEqual(users, [])
        for user in users:
            assert user.name, user
            self.assertIsInstance(user.name, str)
            self.assertIsInstance(user.terminal, (str, type(None)))
            if user.host is not None:
                self.assertIsInstance(user.host, (str, type(None)))
            user.terminal
            user.host
            assert user.started > 0.0, user
            datetime.datetime.fromtimestamp(user.started)
            if WINDOWS or OPENBSD:
                self.assertIsNone(user.pid)
            else:
>               psutil.Process(user.pid)

psutil/tests/test_system.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/__init__.py:332: in __init__
    self._init(pid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = psutil.Process(pid=1100, status='terminated'), pid = 1100, _ignore_nsp = False

    def _init(self, pid, _ignore_nsp=False):
        if pid is None:
            pid = os.getpid()
        else:
            if not _PY3 and not isinstance(pid, (int, long)):
                raise TypeError('pid must be an integer (got %r)' % pid)
            if pid < 0:
                raise ValueError('pid must be a positive integer (got %s)'
                                 % pid)
        self._pid = pid
        self._name = None
        self._exe = None
        self._create_time = None
        self._gone = False
        self._pid_reused = False
        self._hash = None
        self._lock = threading.RLock()
        # used for caching on Windows only (on POSIX ppid may change)
        self._ppid = None
        # platform-specific modules define an _psplatform.Process
        # implementation class
        self._proc = _psplatform.Process(pid)
        self._last_sys_cpu_times = None
        self._last_proc_cpu_times = None
        self._exitcode = _SENTINEL
        # cache creation time for later use in is_running() method
        try:
            self.create_time()
        except AccessDenied:
            # We should never get here as AFAIK we're able to get
            # process creation time on all platforms even as a
            # limited user.
            pass
        except ZombieProcess:
            # Zombies can still be queried by this class (although
            # not always) and pids() return them so just go on.
            pass
        except NoSuchProcess:
            if not _ignore_nsp:
>               raise NoSuchProcess(pid, msg='process PID not found')
E               psutil.NoSuchProcess: process PID not found (pid=1100)

../../BUILDROOT/python-psutil-5.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/__init__.py:373: NoSuchProcess
____________________________________________________________________ TestDiskAPIs.test_disk_partitions _____________________________________________________________________

self = <test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [x.mountpoint.lower() for x in
                  psutil.disk_partitions(all=True) if x.mountpoint]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/proc', '/sys', '/dev', '/sys/kernel/security', '/dev/shm', '/dev/pts', '/run', '/sys/fs/cgroup', '/sys/fs/pstore', '/sys/fs/bpf', '/', '/proc/sys/fs/binfmt_misc', '/dev/mqueue', '/dev/hugepages', '/sys/kernel/debug', '/sys/kernel/tracing', '/tmp', '/sys/fs/fuse/connections', '/sys/kernel/config', '/data', '/var/lib/lxc', '/home', '/boot', '/var/lib/nfs/rpc_pipefs', '/run/user/1000', '/run/user/1001', '/sys/kernel/debug/tracing', '/proc/sys/fs/binfmt_misc']

psutil/tests/test_system.py:642: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] psutil/tests/test_aix.py:107: AIX only
SKIPPED [1] psutil/tests/test_aix.py:74: AIX only
SKIPPED [1] psutil/tests/test_aix.py:113: AIX only
SKIPPED [1] psutil/tests/test_aix.py:53: AIX only
SKIPPED [1] psutil/tests/test_aix.py:23: AIX only
SKIPPED [5] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: BSD only
SKIPPED [32] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: FREEBSD only
SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: OPENBSD only
SKIPPED [9] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: NETBSD only
SKIPPED [9] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:166: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:263: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:151: worthless on POSIX
SKIPPED [60] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:371: WINDOWS only
SKIPPED [24] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: can't locate scripts directory
SKIPPED [14] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: MACOS only
SKIPPED [1] psutil/tests/test_process.py:388: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:517: WINDOWS only
SKIPPED [2] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:153: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:574: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:858: no battery
FAILED psutil/tests/test_linux.py::TestSystemCPUStats::test_ctx_switches - AssertionError: 639746777 != 9229681375 within 500 delta (8589934598 difference)
FAILED psutil/tests/test_linux.py::TestSystemCPUStats::test_interrupts - AssertionError: 1193337845 != 5488305146 within 500 delta (4294967301 difference)
FAILED psutil/tests/test_linux.py::TestSystemNetIfAddrs::test_ips - AssertionError: '2a02:c7e:38c1:5f00:435e:4504:93a5:3025' != 'fdab:c99a:a0f7:1:85f2:ba2b:e617:996b'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt - AssertionError: None != '/dev/nvme1n1p2[/root]'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons - AssertionError: unexpectedly None
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked - AssertionError: '/dev/root' == '/dev/root'
FAILED psutil/tests/test_misc.py::TestMisc::test_debug - AssertionError:
FAILED psutil/tests/test_misc.py::TestMisc::test_setup_script - FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-...
FAILED psutil/tests/test_posix.py::TestSystemAPIs::test_users - AssertionError: 10 != 11
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_system.py::TestMiscAPIs::test_users - psutil.NoSuchProcess: process PID not found (pid=1100)
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - AssertionError: '/home/tkloczko/rpmbuild' not found in ['/proc', '/sys', '/dev', '/sys/kernel/se...
=============================================================== 12 failed, 470 passed, 172 skipped in 17.23s ===============================================================
@kloczek kloczek added the bug label Jan 2, 2022
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Feb 3, 2022
https://build.opensuse.org/request/show/950795
by user mcepl + dimstar_suse
- Fix name of Patch4, it is skip-partitions-erros.patch
- Add skip-partitions-erros.patch skipping tests failing on Linux
  (gh#giampaolo/psutil#2043).
@kloczek
Copy link
Author

kloczek commented Sep 12, 2022

Just retested 5.9.2. pytest still fails but in less units

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly --import-mode=importlib
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.2
collected 656 items

psutil/tests/test_aix.py sssss                                                                                                                                       [  0%]
psutil/tests/test_bsd.py sssssssssssssssssssssssssssssssssssssssssssssss                                                                                             [  7%]
psutil/tests/test_connections.py .................                                                                                                                   [ 10%]
psutil/tests/test_contracts.py ........................................                                                                                              [ 16%]
psutil/tests/test_linux.py ...........F..........................................F.FF........sssssssss.................................                              [ 33%]
psutil/tests/test_memleaks.py .......................s...s.......s.......................s...s.......sss..........s..............                                    [ 48%]
psutil/tests/test_misc.py ...................F..F..................ssssssssssssssssssssssss                                                                          [ 58%]
psutil/tests/test_osx.py ssssssssssssss                                                                                                                              [ 60%]
psutil/tests/test_posix.py ........................                                                                                                                  [ 63%]
psutil/tests/test_process.py .......................s.............s.........................F.................                                                       [ 76%]
psutil/tests/test_sunos.py ss                                                                                                                                        [ 76%]
psutil/tests/test_system.py ..............................F..s......s...                                                                                             [ 83%]
psutil/tests/test_testutils.py .................................                                                                                                     [ 88%]
psutil/tests/test_unicode.py ...................                                                                                                                     [ 91%]
psutil/tests/test_windows.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                                              [100%]

================================================================================= FAILURES =================================================================================
____________________________________________________________________ TestSystemVirtualMemory.test_used _____________________________________________________________________

self = <psutil.tests.test_linux.TestSystemVirtualMemory testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        free = free_physmem()
        free_value = free.used
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            free_value, psutil_value, delta=TOLERANCE_SYS_MEM,
            msg='%s %s \n%s' % (free_value, psutil_value, free.output))
E       AssertionError: 7313412096 != 5880541184 within 5242880 delta (1432870912 difference) : 7313412096 5880541184
E                      total        used        free      shared  buff/cache   available
E       Mem:     134810054656  7313412096 73698439168   312139776 55231074304 127496642560
E       Swap:     9159303168   379752448  8779550720

psutil/tests/test_linux.py:275: AssertionError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
AssertionError('7308054528 != 5875208192 within 5242880 delta (1432846336 difference) : 7308054528 5875208192 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7308054528 73704615936   312115200 55230230528 127502000128\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7309086720 != 5876240384 within 5242880 delta (1432846336 difference) : 7309086720 5876240384 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7309086720 73703583744   312115200 55230230528 127500967936\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7310118912 != 5877272576 within 5242880 delta (1432846336 difference) : 7310118912 5877272576 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7310118912 73702551552   312115200 55230230528 127499935744\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7308996608 != 5876125696 within 5242880 delta (1432870912 difference) : 7308996608 5876125696 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7308996608 73702854656   312139776 55231074304 127501058048\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7310028800 != 5877157888 within 5242880 delta (1432870912 difference) : 7310028800 5877157888 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7310028800 73701822464   312139776 55231074304 127500025856\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7310561280 != 5877690368 within 5242880 delta (1432870912 difference) : 7310561280 5877690368 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7310561280 73701289984   312139776 55231074304 127499493376\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7311851520 != 5878980608 within 5242880 delta (1432870912 difference) : 7311851520 5878980608 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7311851520 73699999744   312139776 55231074304 127498203136\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7312601088 != 5879730176 within 5242880 delta (1432870912 difference) : 7312601088 5879730176 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7312601088 73699250176   312139776 55231074304 127497453568\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7313375232 != 5880504320 within 5242880 delta (1432870912 difference) : 7313375232 5880504320 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7313375232 73698476032   312139776 55231074304 127496679424\nSwap:     9159303168   379752448  8779550720'), retrying
AssertionError('7313412096 != 5880541184 within 5242880 delta (1432870912 difference) : 7313412096 5880541184 \n               total        used        free      shared  buff/cache   available\nMem:     134810054656  7313412096 73698439168   312139776 55231074304 127496642560\nSwap:     9159303168   379752448  8779550720'), retrying
_______________________________________________________________ TestRootFsDeviceFinder.test_against_findmnt ________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme0n1p2[/lxc/devel-g2v/rootfs]'

psutil/tests/test_linux.py:1324: AssertionError
_________________________________________________________________ TestRootFsDeviceFinder.test_comparisons __________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1301: AssertionError
____________________________________________________________ TestRootFsDeviceFinder.test_disk_partitions_mocked ____________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
        with mock.patch(
                'psutil._pslinux.cext.disk_partitions',
                return_value=[('/dev/root', '/', 'ext4', 'rw')]) as m:
            part = psutil.disk_partitions()[0]
            assert m.called
            if not GITHUB_ACTIONS:
>               self.assertNotEqual(part.device, "/dev/root")
E               AssertionError: '/dev/root' == '/dev/root'

psutil/tests/test_linux.py:1333: AssertionError
________________________________________________________________________ TestMisc.test_setup_script ________________________________________________________________________

self = <psutil.tests.test_misc.TestMisc testMethod=test_setup_script>

    @unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
    def test_setup_script(self):
        setup_py = os.path.join(ROOT_DIR, 'setup.py')
        if CI_TESTING and not os.path.exists(setup_py):
            return self.skipTest("can't find setup.py")
>       module = import_module_by_path(setup_py)

psutil/tests/test_misc.py:259:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:1686: in import_module_by_path
    spec.loader.exec_module(mod)
<frozen importlib._bootstrap_external>:839: in exec_module
    ???
<frozen importlib._bootstrap_external>:975: in get_code
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_frozen_importlib_external.SourceFileLoader object at 0x7efd5e6e92b0>
path = '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/setup.py'

>   ???
E   FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/setup.py'

<frozen importlib._bootstrap_external>:1032: FileNotFoundError
_______________________________________________________________________ TestCommonModule.test_debug ________________________________________________________________________

self = <psutil.tests.test_misc.TestCommonModule testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError:
E       assert False
E        +  where False = <built-in method startswith of str object at 0x7efd622fc2f0>('psutil-debug')
E        +    where <built-in method startswith of str object at 0x7efd622fc2f0> = ''.startswith

psutil/tests/test_misc.py:437: AssertionError
________________________________________________________________________ TestProcess.test_terminal _________________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:298: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['tty'], kwds = {'creationflags': 0, 'stderr': -1, 'stdout': -1, 'universal_newlines': True}, flags = 0, p = <subprocess.Popen object at 0x7efd5e66a0d0>
stdout = 'not a tty\n', stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS else 0
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        if isinstance(cmd, str):
            cmd = shlex.split(cmd)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:469: RuntimeError
____________________________________________________________________ TestDiskAPIs.test_disk_partitions _____________________________________________________________________

self = <psutil.tests.test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [x.mountpoint.lower() for x in
                  psutil.disk_partitions(all=True) if x.mountpoint]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/devices/virtual/net', '/sys/fs/fuse/connections', '/sys/fs/cgroup', '/dev/pts', '/dev/ptmx', '/dev/lxc/console', '/dev/console', '/dev/lxc/tty1', '/dev/lxc/tty2', '/dev/lxc/tty3', '/dev/lxc/tty4', '/proc/sys/kernel/random/boot_id', '/dev/shm', '/run', '/dev/mqueue', '/tmp', '/run/user/1000', '/sys/fs/bpf', '/run/netns']

psutil/tests/test_system.py:641: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] psutil/tests/test_aix.py:107: AIX only
SKIPPED [1] psutil/tests/test_aix.py:74: AIX only
SKIPPED [1] psutil/tests/test_aix.py:113: AIX only
SKIPPED [1] psutil/tests/test_aix.py:53: AIX only
SKIPPED [1] psutil/tests/test_aix.py:23: AIX only
SKIPPED [1] psutil/tests/test_bsd.py:124: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:97: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:134: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:88: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:129: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:183: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:221: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:201: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:178: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:163: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:188: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:406: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:258: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:365: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:369: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:373: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:377: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:323: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:358: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:344: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:351: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:330: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:318: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:337: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:415: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:434: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:446: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:459: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:389: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:399: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:394: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:280: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:310: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:298: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:304: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:286: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:292: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:487: OPENBSD only
SKIPPED [1] psutil/tests/test_bsd.py:554: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:543: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:534: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:529: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:539: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:519: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:514: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:524: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:510: NETBSD only
SKIPPED [1] psutil/tests/test_linux.py:1624: no battery
SKIPPED [1] psutil/tests/test_linux.py:1631: no battery
SKIPPED [1] psutil/tests/test_linux.py:1644: no battery
SKIPPED [1] psutil/tests/test_linux.py:1575: no battery
SKIPPED [1] psutil/tests/test_linux.py:1589: no battery
SKIPPED [1] psutil/tests/test_linux.py:1542: no battery
SKIPPED [1] psutil/tests/test_linux.py:1558: no battery
SKIPPED [1] psutil/tests/test_linux.py:1606: no battery
SKIPPED [1] psutil/tests/test_linux.py:1535: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:166: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:263: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:151: worthless on POSIX
SKIPPED [1] psutil/tests/test_memleaks.py:328: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:325: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:371: WINDOWS only
SKIPPED [1] psutil/tests/test_misc.py:839: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:748: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:824: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:767: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:758: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:833: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:770: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:792: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:813: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:804: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:773: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:789: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:807: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:816: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:795: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:776: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:799: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:783: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:786: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:844: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:827: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:810: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:779: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:820: can't locate scripts directory
SKIPPED [1] psutil/tests/test_osx.py:91: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:143: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:139: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:147: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:110: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:212: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:225: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:188: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:194: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:168: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:162: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:174: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:158: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:180: MACOS only
SKIPPED [1] psutil/tests/test_process.py:388: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:517: WINDOWS only
SKIPPED [1] psutil/tests/test_sunos.py:39: SUNOS only
SKIPPED [1] psutil/tests/test_sunos.py:21: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:573: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:857: no battery
SKIPPED [1] psutil/tests/test_windows.py:93: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:87: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:80: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:72: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:98: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:102: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:210: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:219: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:192: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:178: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:148: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:200: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:111: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:138: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:121: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:263: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:276: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:269: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:283: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:238: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:244: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:253: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:361: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:432: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:341: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:478: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:488: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:444: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:306: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:395: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:387: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:463: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:331: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:327: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:310: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:352: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:422: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:521: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:554: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:513: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:534: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:541: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:507: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:527: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:634: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:605: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:598: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:616: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:586: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:626: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:704: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:709: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:714: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:718: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:722: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:728: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:792: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:744: WINDOWS only
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemory::test_used - AssertionError: 7313412096 != 5880541184 within 5242880 delta (1432870912 difference) : 731341209...
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt - AssertionError: None != '/dev/nvme0n1p2[/lxc/devel-g2v/rootfs]'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons - AssertionError: unexpectedly None
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked - AssertionError: '/dev/root' == '/dev/root'
FAILED psutil/tests/test_misc.py::TestMisc::test_setup_script - FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-...
FAILED psutil/tests/test_misc.py::TestCommonModule::test_debug - AssertionError:
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/dev', '/proc', '/proc/sy...
=============================================================== 8 failed, 476 passed, 172 skipped in 11.85s ================================================================

@kloczek
Copy link
Author

kloczek commented Aug 5, 2023

gentle ping .. any update? 🤔
Just tested 5.9.5 and looks like some units are still failing

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.5-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly --import-mode=importlib
============================= test session starts ==============================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.5
collected 669 items

psutil/tests/test_aix.py sssss                                           [  0%]
psutil/tests/test_bsd.py sssssssssssssssssssssssssssssssssssssssssssssss [  7%]
s                                                                        [  7%]
psutil/tests/test_connections.py .................                       [ 10%]
psutil/tests/test_contracts.py ........................................  [ 16%]
psutil/tests/test_linux.py ....F.....F...............................ss. [ 23%]
s............F.FF........sssssssss.................................      [ 33%]
psutil/tests/test_memleaks.py .......................s...s.......s...... [ 39%]
.................s...s.......sss..........s..............                [ 47%]
psutil/tests/test_misc.py ...........................F.................s [ 54%]
sssssssssssssssssssssss                                                  [ 58%]
psutil/tests/test_osx.py ssssssssssssss                                  [ 60%]
psutil/tests/test_posix.py ................s.....ss.                     [ 64%]
psutil/tests/test_process.py .......................s.............s..... [ 70%]
....................F.................                                   [ 76%]
psutil/tests/test_sunos.py ss                                            [ 76%]
psutil/tests/test_system.py .........F....................F..s......s... [ 83%]
                                                                         [ 83%]
psutil/tests/test_testutils.py .................................         [ 88%]
psutil/tests/test_unicode.py ...................                         [ 90%]
psutil/tests/test_windows.py sssssssssssssssssssssssssssssssssssssssssss [ 97%]
ssssssssssssssssss                                                       [100%]

=================================== FAILURES ===================================
_________________ TestSystemVirtualMemoryAgainstFree.test_used _________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstFree testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        cli_value = free_physmem().used
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(cli_value, psutil_value,
                               delta=TOLERANCE_SYS_MEM)
E       AssertionError: 6328909824 != 5060632576 within 5242880 delta (1268277248 difference)

psutil/tests/test_linux.py:270: AssertionError
----------------------------- Captured stderr call -----------------------------
AssertionError('6330933248 != 5062656000 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6330839040 != 5062561792 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6329659392 != 5061382144 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6330904576 != 5062627328 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331936768 != 5063659520 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6332968960 != 5064691712 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331838464 != 5063561216 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6330707968 != 5062430720 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6330118144 != 5061840896 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6328909824 != 5060632576 within 5242880 delta (1268277248 difference)'), retrying
________________ TestSystemVirtualMemoryAgainstVmstat.test_used ________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstVmstat testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        vmstat_value = vmstat('used memory') * 1024
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM)
E       AssertionError: 6331248640 != 5062971392 within 5242880 delta (1268277248 difference)

psutil/tests/test_linux.py:326: AssertionError
----------------------------- Captured stderr call -----------------------------
AssertionError('6330388480 != 5062111232 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331416576 != 5063139328 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331428864 != 5063151616 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6332461056 != 5064183808 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331359232 != 5063081984 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6330896384 != 5062619136 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331928576 != 5063651328 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6332960768 != 5064683520 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331817984 != 5063540736 within 5242880 delta (1268277248 difference)'), retrying
AssertionError('6331248640 != 5062971392 within 5242880 delta (1268277248 difference)'), retrying
_________________ TestRootFsDeviceFinder.test_against_findmnt __________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme0n1p2[/lxc/devel-g2v/rootfs]'

psutil/tests/test_linux.py:1379: AssertionError
___________________ TestRootFsDeviceFinder.test_comparisons ____________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1356: AssertionError
______________ TestRootFsDeviceFinder.test_disk_partitions_mocked ______________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
        with mock.patch(
                'psutil._pslinux.cext.disk_partitions',
                return_value=[('/dev/root', '/', 'ext4', 'rw')]) as m:
            part = psutil.disk_partitions()[0]
            assert m.called
            if not GITHUB_ACTIONS:
>               self.assertNotEqual(part.device, "/dev/root")
E               AssertionError: '/dev/root' == '/dev/root'

psutil/tests/test_linux.py:1388: AssertionError
_________________________ TestCommonModule.test_debug __________________________

self = <psutil.tests.test_misc.TestCommonModule testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError:
E       assert False
E        +  where False = <built-in method startswith of str object at 0x7f290df112f0>('psutil-debug')
E        +    where <built-in method startswith of str object at 0x7f290df112f0> = ''.startswith

psutil/tests/test_misc.py:538: AssertionError
__________________________ TestProcess.test_terminal ___________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:301:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:338: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['tty']
kwds = {'creationflags': 0, 'stderr': -1, 'stdout': -1, 'universal_newlines': True}
flags = 0, p = <subprocess.Popen object at 0x7f28fee85d30>
stdout = 'not a tty\n', stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS else 0
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        if isinstance(cmd, str):
            cmd = shlex.split(cmd)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:509: RuntimeError
___________________________ TestMiscAPIs.test_users ____________________________

self = <psutil.tests.test_system.TestMiscAPIs testMethod=test_users>

    @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
    def test_users(self):
        users = psutil.users()
>       self.assertNotEqual(users, [])
E       AssertionError: [] == []

psutil/tests/test_system.py:206: AssertionError
______________________ TestDiskAPIs.test_disk_partitions _______________________

self = <psutil.tests.test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [x.mountpoint.lower() for x in
                  psutil.disk_partitions(all=True) if x.mountpoint]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/devices/virtual/net', '/sys/fs/fuse/connections', '/sys/fs/cgroup', '/dev/pts', '/dev/ptmx', '/dev/lxc/console', '/dev/console', '/dev/lxc/tty1', '/dev/lxc/tty2', '/dev/lxc/tty3', '/dev/lxc/tty4', '/proc/sys/kernel/random/boot_id', '/dev/shm', '/run', '/dev/mqueue', '/tmp', '/run/user/1000']

psutil/tests/test_system.py:648: AssertionError
=========================== short test summary info ============================
SKIPPED [1] psutil/tests/test_aix.py:107: AIX only
SKIPPED [1] psutil/tests/test_aix.py:74: AIX only
SKIPPED [1] psutil/tests/test_aix.py:113: AIX only
SKIPPED [1] psutil/tests/test_aix.py:53: AIX only
SKIPPED [1] psutil/tests/test_aix.py:23: AIX only
SKIPPED [1] psutil/tests/test_bsd.py:124: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:97: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:135: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:88: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:129: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:185: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:223: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:203: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:180: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:165: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:190: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:408: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:260: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:367: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:371: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:375: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:379: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:325: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:360: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:346: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:353: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:332: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:320: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:339: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:417: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:436: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:448: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:461: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:391: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:401: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:396: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:282: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:312: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:300: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:306: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:288: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:294: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:489: OPENBSD only
SKIPPED [1] psutil/tests/test_bsd.py:567: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:556: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:545: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:540: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:550: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:523: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:533: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:518: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:528: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:514: NETBSD only
SKIPPED [1] psutil/tests/test_linux.py:1004: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1021: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1055: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1679: no battery
SKIPPED [1] psutil/tests/test_linux.py:1686: no battery
SKIPPED [1] psutil/tests/test_linux.py:1699: no battery
SKIPPED [1] psutil/tests/test_linux.py:1630: no battery
SKIPPED [1] psutil/tests/test_linux.py:1644: no battery
SKIPPED [1] psutil/tests/test_linux.py:1597: no battery
SKIPPED [1] psutil/tests/test_linux.py:1613: no battery
SKIPPED [1] psutil/tests/test_linux.py:1661: no battery
SKIPPED [1] psutil/tests/test_linux.py:1590: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:167: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:264: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:152: worthless on POSIX
SKIPPED [1] psutil/tests/test_memleaks.py:329: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:326: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:375: WINDOWS only
SKIPPED [1] psutil/tests/test_misc.py:941: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:850: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:926: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:869: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:860: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:935: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:872: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:894: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:915: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:906: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:875: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:891: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:909: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:918: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:897: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:878: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:901: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:885: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:888: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:946: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:929: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:912: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:881: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:922: can't locate scripts directory
SKIPPED [1] psutil/tests/test_osx.py:65: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:117: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:113: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:122: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:84: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:178: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:191: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:164: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:170: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:144: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:138: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:150: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:134: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:156: MACOS only
SKIPPED [1] psutil/tests/test_posix.py:325: no ifconfig cmd
SKIPPED [1] psutil/tests/test_posix.py:340: no users on this system
SKIPPED [1] psutil/tests/test_posix.py:356: no users on this system
SKIPPED [1] psutil/tests/test_process.py:391: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:520: WINDOWS only
SKIPPED [1] psutil/tests/test_sunos.py:39: SUNOS only
SKIPPED [1] psutil/tests/test_sunos.py:21: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:580: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:865: no battery
SKIPPED [1] psutil/tests/test_windows.py:126: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:120: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:113: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:105: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:131: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:135: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:270: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:279: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:252: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:238: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:208: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:159: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:260: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:144: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:173: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:198: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:154: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:165: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:323: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:336: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:329: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:343: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:298: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:304: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:313: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:421: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:492: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:401: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:538: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:548: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:504: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:366: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:455: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:447: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:523: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:391: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:387: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:370: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:412: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:482: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:581: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:614: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:573: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:594: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:601: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:567: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:587: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:694: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:665: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:658: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:676: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:646: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:686: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:764: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:769: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:774: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:778: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:782: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:788: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:852: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:804: WINDOWS only
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstFree::test_used
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstVmstat::test_used
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked
FAILED psutil/tests/test_misc.py::TestCommonModule::test_debug - AssertionErr...
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_system.py::TestMiscAPIs::test_users - AssertionError...
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - Asse...
================= 9 failed, 478 passed, 182 skipped in 10.38s ==================

@kloczek
Copy link
Author

kloczek commented Feb 14, 2024

Just for FTR

pytest output of the 5.9.8 version
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly --import-mode=importlib
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8
plugins: asyncio-0.23.5, pytest_httpserver-1.0.9
asyncio: mode=strict
collected 668 items

psutil/tests/test_aix.py sssss                                                                                                                                                        [  0%]
psutil/tests/test_bsd.py ssssssssssssssssssssssssssssssssssssssssssssssss                                                                                                             [  7%]
psutil/tests/test_connections.py .................                                                                                                                                    [ 10%]
psutil/tests/test_contracts.py .......................................                                                                                                                [ 16%]
psutil/tests/test_linux.py ....F.....F..............................F................F.FF........sssssssss........F.......................                                            [ 32%]
psutil/tests/test_memleaks.py .......................s...s.......s.......................s...s.......sss..........s..............                                                     [ 47%]
psutil/tests/test_misc.py ............................F.................ssssssssssssssssssssssss                                                                                      [ 58%]
psutil/tests/test_osx.py ssssssssssssss                                                                                                                                               [ 60%]
psutil/tests/test_posix.py .........................                                                                                                                                  [ 64%]
psutil/tests/test_process.py .......................s.............s........................F.................                                                                         [ 76%]
psutil/tests/test_process_all.py .                                                                                                                                                    [ 76%]
psutil/tests/test_sunos.py ss                                                                                                                                                         [ 76%]
psutil/tests/test_system.py ..............................F..s......s...                                                                                                              [ 83%]
psutil/tests/test_testutils.py .................................                                                                                                                      [ 88%]
psutil/tests/test_unicode.py ...................                                                                                                                                      [ 90%]
psutil/tests/test_windows.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                                                            [100%]

========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________________ TestSystemVirtualMemoryAgainstFree.test_used ________________________________________________________________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstFree testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        cli_value = free_physmem().used
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            cli_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 10913640448 != 6875762688 within 5242880 delta (4037877760 difference)

psutil/tests/test_linux.py:285: AssertionError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
AssertionError('10927861760 != 6889476096 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10928631808 != 6890246144 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10929664000 != 6891278336 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10930696192 != 6892310528 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10927267840 != 6888882176 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10928300032 != 6889914368 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10920448000 != 6882062336 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10921996288 != 6883610624 within 5242880 delta (4038385664 difference)'), retrying
AssertionError('10912641024 != 6874222592 within 5242880 delta (4038418432 difference)'), retrying
AssertionError('10913640448 != 6875762688 within 5242880 delta (4037877760 difference)'), retrying
______________________________________________________________________ TestSystemVirtualMemoryAgainstVmstat.test_used _______________________________________________________________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstVmstat testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        vmstat_value = vmstat('used memory') * 1024
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 10926813184 != 6888398848 within 5242880 delta (4038414336 difference)

psutil/tests/test_linux.py:349: AssertionError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
AssertionError('10918092800 != 6879924224 within 5242880 delta (4038168576 difference)'), retrying
AssertionError('10918338560 != 6879924224 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10919370752 != 6880956416 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10920398848 != 6881984512 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10921676800 != 6883262464 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10922708992 != 6884294656 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10923225088 != 6885056512 within 5242880 delta (4038168576 difference)'), retrying
AssertionError('10924503040 != 6886088704 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10925535232 != 6887120896 within 5242880 delta (4038414336 difference)'), retrying
AssertionError('10926813184 != 6888398848 within 5242880 delta (4038414336 difference)'), retrying
_______________________________________________________________________________ TestSystemNetIfAddrs.test_ips _______________________________________________________________________________

self = <psutil.tests.test_linux.TestSystemNetIfAddrs testMethod=test_ips>

    def test_ips(self):
        for name, addrs in psutil.net_if_addrs().items():
            for addr in addrs:
                if addr.family == psutil.AF_LINK:
>                   self.assertEqual(addr.address, get_mac_address(name))
E                   AssertionError: '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00' != '00:00:00:00:00:00'
E                   - 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
E                   + 00:00:00:00:00:00

psutil/tests/test_linux.py:1004: AssertionError
________________________________________________________________________ TestRootFsDeviceFinder.test_against_findmnt ________________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme0n1p2[/lxc/pers-jacek/rootfs]'

psutil/tests/test_linux.py:1434: AssertionError
__________________________________________________________________________ TestRootFsDeviceFinder.test_comparisons __________________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1410: AssertionError
____________________________________________________________________ TestRootFsDeviceFinder.test_disk_partitions_mocked _____________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
        with mock.patch(
            'psutil._pslinux.cext.disk_partitions',
            return_value=[('/dev/root', '/', 'ext4', 'rw')],
        ) as m:
            part = psutil.disk_partitions()[0]
            assert m.called
            if not GITHUB_ACTIONS:
>               self.assertNotEqual(part.device, "/dev/root")
E               AssertionError: '/dev/root' == '/dev/root'

psutil/tests/test_linux.py:1444: AssertionError
________________________________________________________________________________ TestProcess.test_exe_mocked ________________________________________________________________________________

self = <psutil.tests.test_linux.TestProcess testMethod=test_exe_mocked>

    def test_exe_mocked(self):
        with mock.patch(
            'psutil._pslinux.readlink', side_effect=OSError(errno.ENOENT, "")
        ) as m:
            ret = psutil.Process().exe()
            assert m.called
>           self.assertEqual(ret, "")
E           AssertionError: '/usr/bin/python3' != ''
E           - /usr/bin/python3
E           +

psutil/tests/test_linux.py:2121: AssertionError
________________________________________________________________________________ TestCommonModule.test_debug ________________________________________________________________________________

self = <psutil.tests.test_misc.TestCommonModule testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError:
E       assert False
E        +  where False = <built-in method startswith of str object at 0x7fcdab7ac2f0>('psutil-debug')
E        +    where <built-in method startswith of str object at 0x7fcdab7ac2f0> = ''.startswith

psutil/tests/test_misc.py:581: AssertionError
_________________________________________________________________________________ TestProcess.test_terminal _________________________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:345: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['tty'], kwds = {'creationflags': 0, 'stderr': -1, 'stdout': -1, 'universal_newlines': True}, flags = 0, p = <subprocess.Popen object at 0x7fcda941c040>, stdout = 'not a tty\n'
stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """Run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS else 0
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        if isinstance(cmd, str):
            cmd = shlex.split(cmd)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.8-2.fc35.x86_64/usr/lib64/python3.8/site-packages/psutil/tests/__init__.py:519: RuntimeError
_____________________________________________________________________________ TestDiskAPIs.test_disk_partitions _____________________________________________________________________________

self = <psutil.tests.test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device  # noqa
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [
            x.mountpoint.lower()
            for x in psutil.disk_partitions(all=True)
            if x.mountpoint
        ]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/var/lib/systemd/coredump', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/devices/virtual/net', '/sys/fs/fuse/connections', '/sys/fs/cgroup', '/dev/pts', '/dev/ptmx', '/dev/lxc/console', '/dev/console', '/dev/lxc/tty1', '/dev/lxc/tty2', '/dev/lxc/tty3', '/dev/lxc/tty4', '/proc/sys/kernel/random/boot_id', '/dev/shm', '/run', '/dev/mqueue', '/tmp', '/run/user/1000']

psutil/tests/test_system.py:702: AssertionError
================================================================================== short test summary info ==================================================================================
SKIPPED [1] psutil/tests/test_aix.py:121: AIX only
SKIPPED [1] psutil/tests/test_aix.py:81: AIX only
SKIPPED [1] psutil/tests/test_aix.py:127: AIX only
SKIPPED [1] psutil/tests/test_aix.py:56: AIX only
SKIPPED [1] psutil/tests/test_aix.py:22: AIX only
SKIPPED [1] psutil/tests/test_bsd.py:125: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:98: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:136: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:88: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:130: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:187: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:227: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:207: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:181: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:166: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:194: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:438: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:263: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:382: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:389: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:396: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:403: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:334: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:374: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:358: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:366: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:342: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:329: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:350: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:447: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:467: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:482: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:495: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:418: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:430: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:424: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:285: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:320: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:306: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:313: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:292: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:299: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:525: OPENBSD only
SKIPPED [1] psutil/tests/test_bsd.py:616: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:604: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:591: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:584: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:598: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:561: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:575: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:554: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:568: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:549: NETBSD only
SKIPPED [1] psutil/tests/test_linux.py:1719: no battery
SKIPPED [1] psutil/tests/test_linux.py:1727: no battery
SKIPPED [1] psutil/tests/test_linux.py:1743: no battery
SKIPPED [1] psutil/tests/test_linux.py:1668: no battery
SKIPPED [1] psutil/tests/test_linux.py:1682: no battery
SKIPPED [1] psutil/tests/test_linux.py:1634: no battery
SKIPPED [1] psutil/tests/test_linux.py:1651: no battery
SKIPPED [1] psutil/tests/test_linux.py:1699: no battery
SKIPPED [1] psutil/tests/test_linux.py:1627: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:169: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:265: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:154: worthless on POSIX
SKIPPED [1] psutil/tests/test_memleaks.py:329: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:326: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:376: WINDOWS only
SKIPPED [1] psutil/tests/test_misc.py:1000: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:907: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:985: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:928: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:919: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:994: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:931: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:953: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:974: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:965: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:934: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:950: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:968: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:977: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:956: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:937: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:960: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:944: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:947: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:1005: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:988: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:971: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:940: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:981: can't locate scripts directory
SKIPPED [1] psutil/tests/test_osx.py:64: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:118: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:114: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:123: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:83: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:182: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:196: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:168: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:174: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:148: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:142: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:154: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:138: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:160: MACOS only
SKIPPED [1] psutil/tests/test_process.py:401: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:531: WINDOWS only
SKIPPED [1] psutil/tests/test_sunos.py:37: SUNOS only
SKIPPED [1] psutil/tests/test_sunos.py:20: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:631: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:937: no battery
SKIPPED [1] psutil/tests/test_windows.py:129: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:122: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:115: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:105: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:134: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:139: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:290: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:300: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:265: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:248: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:217: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:164: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:278: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:147: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:182: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:207: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:158: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:172: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:346: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:363: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:354: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:372: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:318: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:324: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:335: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:455: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:533: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:433: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:591: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:601: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:547: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:397: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:490: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:481: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:573: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:422: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:418: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:401: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:446: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:522: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:634: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:666: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:626: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:646: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:653: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:620: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:639: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:760: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:721: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:712: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:736: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:698: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:749: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:832: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:837: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:842: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:846: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:850: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:856: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:915: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:871: WINDOWS only
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstFree::test_used - AssertionError: 10913640448 != 6875762688 within 5242880 delta (4037877760 difference)
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstVmstat::test_used - AssertionError: 10926813184 != 6888398848 within 5242880 delta (4038414336 difference)
FAILED psutil/tests/test_linux.py::TestSystemNetIfAddrs::test_ips - AssertionError: '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00' != '00:00:00:00:00:00'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt - AssertionError: None != '/dev/nvme0n1p2[/lxc/pers-jacek/rootfs]'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons - AssertionError: unexpectedly None
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked - AssertionError: '/dev/root' == '/dev/root'
FAILED psutil/tests/test_linux.py::TestProcess::test_exe_mocked - AssertionError: '/usr/bin/python3' != ''
FAILED psutil/tests/test_misc.py::TestCommonModule::test_debug - AssertionError:
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/var/lib/systemd/coredump', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/d...

@kloczek
Copy link
Author

kloczek commented Mar 9, 2024

I've moved to python 3.9 an pytest 8.1.0 and looks like now pytest fails in more units

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib/python3.9/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly --import-mode=importlib
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.9.18, pytest-8.1.0, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8
configfile: pyproject.toml
collected 668 items

psutil/tests/test_aix.py sssss                                                                                                                                                        [  0%]
psutil/tests/test_bsd.py ssssssssssssssssssssssssssssssssssssssssssssssss                                                                                                             [  7%]
psutil/tests/test_connections.py .................                                                                                                                                    [ 10%]
psutil/tests/test_contracts.py .......................................                                                                                                                [ 16%]
psutil/tests/test_linux.py ....F.....F........F.........F....FFF.........F...FFFFFFFFF.FF....F.F.sssssssss.......FF.F.F...FF..F..F........                                            [ 32%]
psutil/tests/test_memleaks.py .......................s...s.......s.......................s...s.......sss..........s..............                                                     [ 47%]
psutil/tests/test_misc.py ..................F.........F.................ssssssssssssssssssssssss                                                                                      [ 58%]
psutil/tests/test_osx.py ssssssssssssss                                                                                                                                               [ 60%]
psutil/tests/test_posix.py .................FFFF....                                                                                                                                  [ 64%]
psutil/tests/test_process.py F.........F............s.............s........................F............F....                                                                         [ 76%]
psutil/tests/test_process_all.py .                                                                                                                                                    [ 76%]
psutil/tests/test_sunos.py ss                                                                                                                                                         [ 76%]
psutil/tests/test_system.py ...F..........................F..s......s...                                                                                                              [ 83%]
psutil/tests/test_testutils.py ..........FF....F................                                                                                                                      [ 88%]
psutil/tests/test_unicode.py ...................                                                                                                                                      [ 90%]
psutil/tests/test_windows.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                                                            [100%]

========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________________ TestSystemVirtualMemoryAgainstFree.test_used ________________________________________________________________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstFree testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        cli_value = free_physmem().used
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            cli_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 6152015872 != 5317611520 within 5242880 delta (834404352 difference)

psutil/tests/test_linux.py:285: AssertionError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
AssertionError('6152658944 != 5318590464 within 5242880 delta (834068480 difference)'), retrying
AssertionError('6152396800 != 5317951488 within 5242880 delta (834445312 difference)'), retrying
AssertionError('6153306112 != 5318852608 within 5242880 delta (834453504 difference)'), retrying
AssertionError('6153482240 != 5319004160 within 5242880 delta (834478080 difference)'), retrying
AssertionError('6155878400 != 5321695232 within 5242880 delta (834183168 difference)'), retrying
AssertionError('6152146944 != 5317697536 within 5242880 delta (834449408 difference)'), retrying
AssertionError('6152798208 != 5318049792 within 5242880 delta (834748416 difference)'), retrying
AssertionError('6150840320 != 5316419584 within 5242880 delta (834420736 difference)'), retrying
AssertionError('6151553024 != 5317062656 within 5242880 delta (834490368 difference)'), retrying
AssertionError('6152015872 != 5317611520 within 5242880 delta (834404352 difference)'), retrying
______________________________________________________________________ TestSystemVirtualMemoryAgainstVmstat.test_used _______________________________________________________________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstVmstat testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        vmstat_value = vmstat('used memory') * 1024
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 6152683520 != 5318025216 within 5242880 delta (834658304 difference)

psutil/tests/test_linux.py:349: AssertionError
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------
AssertionError('6152654848 != 5318459392 within 5242880 delta (834195456 difference)'), retrying
AssertionError('6154264576 != 5319847936 within 5242880 delta (834416640 difference)'), retrying
AssertionError('6154780672 != 5320306688 within 5242880 delta (834473984 difference)'), retrying
AssertionError('6155628544 != 5321191424 within 5242880 delta (834437120 difference)'), retrying
AssertionError('6156464128 != 5322047488 within 5242880 delta (834416640 difference)'), retrying
AssertionError('6149201920 != 5315006464 within 5242880 delta (834195456 difference)'), retrying
AssertionError('6150377472 != 5315956736 within 5242880 delta (834420736 difference)'), retrying
AssertionError('6150144000 != 5315682304 within 5242880 delta (834461696 difference)'), retrying
AssertionError('6151237632 != 5316812800 within 5242880 delta (834424832 difference)'), retrying
AssertionError('6152683520 != 5318025216 within 5242880 delta (834658304 difference)'), retrying
_____________________________________________________________________ TestSystemSwapMemory.test_meminfo_against_sysinfo _____________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemSwapMemory testMethod=test_meminfo_against_sysinfo>

    def test_meminfo_against_sysinfo(self):
        # Make sure the content of /proc/meminfo about swap memory
        # matches sysinfo() syscall, see:
        # https://github.com/giampaolo/psutil/issues/1015
        if not self.meminfo_has_swap_info():
            return unittest.skip("/proc/meminfo has no swap metrics")
>       with mock.patch('psutil._pslinux.cext.linux_sysinfo') as m:

psutil/tests/test_linux.py:673:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_____________________________________________________________________ TestSystemCPUCountLogical.test_emulate_fallbacks ______________________________________________________________________

self = <psutil.tests.test_linux.TestSystemCPUCountLogical testMethod=test_emulate_fallbacks>

    def test_emulate_fallbacks(self):
        import psutil._pslinux

>       original = psutil._pslinux.cpu_count_logical()
E       AttributeError: module 'psutil' has no attribute '_pslinux'

psutil/tests/test_linux.py:754: AttributeError
_______________________________________________________________________ TestSystemCPUFrequency.test_emulate_multi_cpu _______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemCPUFrequency testMethod=test_emulate_multi_cpu>

    @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
    def test_emulate_multi_cpu(self):
        def open_mock(name, *args, **kwargs):
            n = name
            if n.endswith('/scaling_cur_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy0"
            ):
                return io.BytesIO(b"100000")
            elif n.endswith('/scaling_min_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy0"
            ):
                return io.BytesIO(b"200000")
            elif n.endswith('/scaling_max_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy0"
            ):
                return io.BytesIO(b"300000")
            elif n.endswith('/scaling_cur_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy1"
            ):
                return io.BytesIO(b"400000")
            elif n.endswith('/scaling_min_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy1"
            ):
                return io.BytesIO(b"500000")
            elif n.endswith('/scaling_max_freq') and n.startswith(
                "/sys/devices/system/cpu/cpufreq/policy1"
            ):
                return io.BytesIO(b"600000")
            elif name == '/proc/cpuinfo':
                return io.BytesIO(b"cpu MHz     : 100\ncpu MHz     : 400")
            else:
                return orig_open(name, *args, **kwargs)

        orig_open = open
        patch_point = 'builtins.open' if PY3 else '__builtin__.open'
        with mock.patch(patch_point, side_effect=open_mock):
            with mock.patch('os.path.exists', return_value=True):
>               with mock.patch(
                    'psutil._pslinux.cpu_count_logical', return_value=2
                ):

psutil/tests/test_linux.py:928:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_______________________________________________________________ TestSystemCPUFrequency.test_emulate_no_scaling_cur_freq_file ________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemCPUFrequency testMethod=test_emulate_no_scaling_cur_freq_file>

    @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
    def test_emulate_no_scaling_cur_freq_file(self):
        # See: https://github.com/giampaolo/psutil/issues/1071
        def open_mock(name, *args, **kwargs):
            if name.endswith('/scaling_cur_freq'):
                raise IOError(errno.ENOENT, "")
            elif name.endswith('/cpuinfo_cur_freq'):
                return io.BytesIO(b"200000")
            elif name == '/proc/cpuinfo':
                return io.BytesIO(b"cpu MHz     : 200")
            else:
                return orig_open(name, *args, **kwargs)

        orig_open = open
        patch_point = 'builtins.open' if PY3 else '__builtin__.open'
        with mock.patch(patch_point, side_effect=open_mock):
            with mock.patch('os.path.exists', return_value=True):
>               with mock.patch(
                    'psutil._pslinux.cpu_count_logical', return_value=1
                ):

psutil/tests/test_linux.py:960:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
______________________________________________________________________ TestSystemCPUFrequency.test_emulate_use_cpuinfo ______________________________________________________________________

self = <psutil.tests.test_linux.TestSystemCPUFrequency testMethod=test_emulate_use_cpuinfo>

    @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
    def test_emulate_use_cpuinfo(self):
        # Emulate a case where /sys/devices/system/cpu/cpufreq* does not
        # exist and /proc/cpuinfo is used instead.
        def path_exists_mock(path):
            if path.startswith('/sys/devices/system/cpu/'):
                return False
            else:
                return os_path_exists(path)

        os_path_exists = os.path.exists
        try:
            with mock.patch("os.path.exists", side_effect=path_exists_mock):
                reload_module(psutil._pslinux)
                ret = psutil.cpu_freq()
                assert ret, ret
                self.assertEqual(ret.max, 0.0)
                self.assertEqual(ret.min, 0.0)
                for freq in psutil.cpu_freq(percpu=True):
                    self.assertEqual(freq.max, 0.0)
                    self.assertEqual(freq.min, 0.0)
        finally:
            reload_module(psutil._pslinux)
>           reload_module(psutil)

psutil/tests/test_linux.py:856:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/tests/__init__.py:1915: in reload_module
    return importlib.reload(module)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/__init__.py'>

    def reload(module):
        """Reload the module and return it.

        The module must have been successfully imported before.

        """
        if not module or not isinstance(module, types.ModuleType):
            raise TypeError("reload() argument must be a module")
        try:
            name = module.__spec__.name
        except AttributeError:
            name = module.__name__

        if sys.modules.get(name) is not module:
            msg = "module {} not in sys.modules"
>           raise ImportError(msg.format(name), name=name)
E           ImportError: module psutil not in sys.modules

/usr/lib64/python3.9/importlib/__init__.py:148: ImportError
__________________________________________________________________ TestSystemNetConnections.test_emulate_ipv6_unsupported ___________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:
/usr/lib64/python3.9/unittest/mock.py:1333: in patched
    with self.decoration_helper(patched,
/usr/lib64/python3.9/contextlib.py:119: in __enter__
    return next(self.gen)
/usr/lib64/python3.9/unittest/mock.py:1315: in decoration_helper
    arg = exit_stack.enter_context(patching)
/usr/lib64/python3.9/contextlib.py:448: in enter_context
    result = _cm_type.__enter__(cm)
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
___________________________________________________________________________ TestSystemDiskPartitions.test_zfs_fs ____________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskPartitions testMethod=test_zfs_fs>

    def test_zfs_fs(self):
        # Test that ZFS partitions are returned.
        with open("/proc/filesystems") as f:
            data = f.read()
        if 'zfs' in data:
            for part in psutil.disk_partitions():
                if part.fstype == 'zfs':
                    break
            else:
                raise self.fail("couldn't find any ZFS partition")
        else:
            # No ZFS partitions on this system. Let's fake one.
            fake_file = io.StringIO(u("nodev\tzfs\n"))
            with mock.patch(
                'psutil._common.open', return_value=fake_file, create=True
            ) as m1:
>               with mock.patch(
                    'psutil._pslinux.cext.disk_partitions',
                    return_value=[('/dev/sdb3', '/', 'zfs', 'rw')],
                ) as m2:

psutil/tests/test_linux.py:1225:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________ TestSystemDiskIoCounters.test_emulate_exclude_partitions __________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_exclude_partitions>

    def test_emulate_exclude_partitions(self):
        # Make sure that when perdisk=False partitions (e.g. 'sda1',
        # 'nvme0n1p1') are skipped and not included in the total count.
        # https://github.com/giampaolo/psutil/pull/1313#issuecomment-408626842
        content = textwrap.dedent("""\
            3    0   nvme0n1 1 2 3 4 5 6 7 8 9 10 11
            3    0   nvme0n1p1 1 2 3 4 5 6 7 8 9 10 11
            """)
        with mock_open_content({"/proc/diskstats": content}):
>           with mock.patch(
                'psutil._pslinux.is_storage_device', return_value=False
            ):

psutil/tests/test_linux.py:1339:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________ TestSystemDiskIoCounters.test_emulate_include_partitions __________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_include_partitions>

    def test_emulate_include_partitions(self):
        # Make sure that when perdisk=True disk partitions are returned,
        # see:
        # https://github.com/giampaolo/psutil/pull/1313#issuecomment-408626842
        content = textwrap.dedent("""\
            3    0   nvme0n1 1 2 3 4 5 6 7 8 9 10 11
            3    0   nvme0n1p1 1 2 3 4 5 6 7 8 9 10 11
            """)
        with mock_open_content({"/proc/diskstats": content}):
>           with mock.patch(
                'psutil._pslinux.is_storage_device', return_value=False
            ):

psutil/tests/test_linux.py:1320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_____________________________________________________________________ TestSystemDiskIoCounters.test_emulate_kernel_2_4 ______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_kernel_2_4>

    def test_emulate_kernel_2_4(self):
        # Tests /proc/diskstats parsing format for 2.4 kernels, see:
        # https://github.com/giampaolo/psutil/issues/767
        content = "   3     0   1 hda 2 3 4 5 6 7 8 9 10 11 12"
        with mock_open_content({'/proc/diskstats': content}):
>           with mock.patch(
                'psutil._pslinux.is_storage_device', return_value=True
            ):

psutil/tests/test_linux.py:1255:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
___________________________________________________________________ TestSystemDiskIoCounters.test_emulate_kernel_2_6_full ___________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_kernel_2_6_full>

    def test_emulate_kernel_2_6_full(self):
        # Tests /proc/diskstats parsing format for 2.6 kernels,
        # lines reporting all metrics:
        # https://github.com/giampaolo/psutil/issues/767
        content = "   3    0   hda 1 2 3 4 5 6 7 8 9 10 11"
        with mock_open_content({"/proc/diskstats": content}):
>           with mock.patch(
                'psutil._pslinux.is_storage_device', return_value=True
            ):

psutil/tests/test_linux.py:1275:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________ TestSystemDiskIoCounters.test_emulate_kernel_2_6_limited __________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_kernel_2_6_limited>

    def test_emulate_kernel_2_6_limited(self):
        # Tests /proc/diskstats parsing format for 2.6 kernels,
        # where one line of /proc/partitions return a limited
        # amount of metrics when it bumps into a partition
        # (instead of a disk). See:
        # https://github.com/giampaolo/psutil/issues/767
        with mock_open_content({"/proc/diskstats": "   3    1   hda 1 2 3 4"}):
>           with mock.patch(
                'psutil._pslinux.is_storage_device', return_value=True
            ):

psutil/tests/test_linux.py:1296:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
______________________________________________________________________ TestSystemDiskIoCounters.test_emulate_not_impl _______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_not_impl>

    def test_emulate_not_impl(self):
        def exists(path):
            return False

>       with mock.patch(
            'psutil._pslinux.os.path.exists', create=True, side_effect=exists
        ):

psutil/tests/test_linux.py:1380:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
______________________________________________________________________ TestSystemDiskIoCounters.test_emulate_use_sysfs ______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestSystemDiskIoCounters testMethod=test_emulate_use_sysfs>

    def test_emulate_use_sysfs(self):
        def exists(path):
            if path == '/proc/diskstats':
                return False
            return True

        wprocfs = psutil.disk_io_counters(perdisk=True)
>       with mock.patch(
            'psutil._pslinux.os.path.exists', create=True, side_effect=exists
        ):

psutil/tests/test_linux.py:1370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
________________________________________________________________________ TestRootFsDeviceFinder.test_against_findmnt ________________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme0n1p2[/lxc/pers-jacek/rootfs]'

psutil/tests/test_linux.py:1434: AssertionError
__________________________________________________________________________ TestRootFsDeviceFinder.test_comparisons __________________________________________________________________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1410: AssertionError
____________________________________________________________________ TestRootFsDeviceFinder.test_disk_partitions_mocked _____________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
>       with mock.patch(
            'psutil._pslinux.cext.disk_partitions',
            return_value=[('/dev/root', '/', 'ext4', 'rw')],
        ) as m:

psutil/tests/test_linux.py:1437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_____________________________________________________________________________ TestMisc.test_no_procfs_on_import _____________________________________________________________________________

self = <psutil.tests.test_linux.TestMisc testMethod=test_no_procfs_on_import>

    def test_no_procfs_on_import(self):
        my_procfs = self.get_testfn()
        os.mkdir(my_procfs)

        with open(os.path.join(my_procfs, 'stat'), 'w') as f:
            f.write('cpu   0 0 0 0 0 0 0 0 0 0\n')
            f.write('cpu0  0 0 0 0 0 0 0 0 0 0\n')
            f.write('cpu1  0 0 0 0 0 0 0 0 0 0\n')

        try:
            orig_open = open

            def open_mock(name, *args, **kwargs):
                if name.startswith('/proc'):
                    raise IOError(errno.ENOENT, 'rejecting access for test')
                return orig_open(name, *args, **kwargs)

            patch_point = 'builtins.open' if PY3 else '__builtin__.open'
            with mock.patch(patch_point, side_effect=open_mock):
>               reload_module(psutil)

psutil/tests/test_linux.py:1481:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/tests/__init__.py:1915: in reload_module
    return importlib.reload(module)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/__init__.py'>

    def reload(module):
        """Reload the module and return it.

        The module must have been successfully imported before.

        """
        if not module or not isinstance(module, types.ModuleType):
            raise TypeError("reload() argument must be a module")
        try:
            name = module.__spec__.name
        except AttributeError:
            name = module.__name__

        if sys.modules.get(name) is not module:
            msg = "module {} not in sys.modules"
>           raise ImportError(msg.format(name), name=name)
E           ImportError: module psutil not in sys.modules

/usr/lib64/python3.9/importlib/__init__.py:148: ImportError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestMisc testMethod=test_no_procfs_on_import>

    def test_no_procfs_on_import(self):
        my_procfs = self.get_testfn()
        os.mkdir(my_procfs)

        with open(os.path.join(my_procfs, 'stat'), 'w') as f:
            f.write('cpu   0 0 0 0 0 0 0 0 0 0\n')
            f.write('cpu0  0 0 0 0 0 0 0 0 0 0\n')
            f.write('cpu1  0 0 0 0 0 0 0 0 0 0\n')

        try:
            orig_open = open

            def open_mock(name, *args, **kwargs):
                if name.startswith('/proc'):
                    raise IOError(errno.ENOENT, 'rejecting access for test')
                return orig_open(name, *args, **kwargs)

            patch_point = 'builtins.open' if PY3 else '__builtin__.open'
            with mock.patch(patch_point, side_effect=open_mock):
                reload_module(psutil)

                self.assertRaises(IOError, psutil.cpu_times)
                self.assertRaises(IOError, psutil.cpu_times, percpu=True)
                self.assertRaises(IOError, psutil.cpu_percent)
                self.assertRaises(IOError, psutil.cpu_percent, percpu=True)
                self.assertRaises(IOError, psutil.cpu_times_percent)
                self.assertRaises(
                    IOError, psutil.cpu_times_percent, percpu=True
                )

                psutil.PROCFS_PATH = my_procfs

                self.assertEqual(psutil.cpu_percent(), 0)
                self.assertEqual(sum(psutil.cpu_times_percent()), 0)

                # since we don't know the number of CPUs at import time,
                # we awkwardly say there are none until the second call
                per_cpu_percent = psutil.cpu_percent(percpu=True)
                self.assertEqual(sum(per_cpu_percent), 0)

                # ditto awkward length
                per_cpu_times_percent = psutil.cpu_times_percent(percpu=True)
                self.assertEqual(sum(map(sum, per_cpu_times_percent)), 0)

                # much user, very busy
                with open(os.path.join(my_procfs, 'stat'), 'w') as f:
                    f.write('cpu   1 0 0 0 0 0 0 0 0 0\n')
                    f.write('cpu0  1 0 0 0 0 0 0 0 0 0\n')
                    f.write('cpu1  1 0 0 0 0 0 0 0 0 0\n')

                self.assertNotEqual(psutil.cpu_percent(), 0)
                self.assertNotEqual(sum(psutil.cpu_percent(percpu=True)), 0)
                self.assertNotEqual(sum(psutil.cpu_times_percent()), 0)
                self.assertNotEqual(
                    sum(map(sum, psutil.cpu_times_percent(percpu=True))), 0
                )
        finally:
            shutil.rmtree(my_procfs)
>           reload_module(psutil)

psutil/tests/test_linux.py:1520:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/tests/__init__.py:1915: in reload_module
    return importlib.reload(module)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/__init__.py'>

    def reload(module):
        """Reload the module and return it.

        The module must have been successfully imported before.

        """
        if not module or not isinstance(module, types.ModuleType):
            raise TypeError("reload() argument must be a module")
        try:
            name = module.__spec__.name
        except AttributeError:
            name = module.__name__

        if sys.modules.get(name) is not module:
            msg = "module {} not in sys.modules"
>           raise ImportError(msg.format(name), name=name)
E           ImportError: module psutil not in sys.modules

/usr/lib64/python3.9/importlib/__init__.py:148: ImportError
_________________________________________________________________________________ TestMisc.test_procfs_path _________________________________________________________________________________

self = <psutil.tests.test_linux.TestMisc testMethod=test_procfs_path>

    def test_procfs_path(self):
        tdir = self.get_testfn()
        os.mkdir(tdir)
        try:
            psutil.PROCFS_PATH = tdir
>           self.assertRaises(IOError, psutil.virtual_memory)
E           AssertionError: OSError not raised by virtual_memory

psutil/tests/test_linux.py:1579: AssertionError
_________________________________________________________________________ TestProcess.test_connections_enametoolong _________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_connections_enametoolong>

    def test_connections_enametoolong(self):
        # Simulate a case where /proc/{pid}/fd/{fd} symlink points to
        # a file with full path longer than PATH_MAX, see:
        # https://github.com/giampaolo/psutil/issues/1940
>       with mock.patch(
            'psutil._pslinux.os.readlink',
            side_effect=OSError(errno.ENAMETOOLONG, ""),
        ) as m:

psutil/tests/test_linux.py:2244:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
________________________________________________________________________________ TestProcess.test_exe_mocked ________________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_exe_mocked>

    def test_exe_mocked(self):
>       with mock.patch(
            'psutil._pslinux.readlink', side_effect=OSError(errno.ENOENT, "")
        ) as m:

psutil/tests/test_linux.py:2116:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________________ TestProcess.test_open_files_enametoolong __________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_open_files_enametoolong>

    def test_open_files_enametoolong(self):
        # Simulate a case where /proc/{pid}/fd/{fd} symlink
        # points to a file with full path longer than PATH_MAX, see:
        # https://github.com/giampaolo/psutil/issues/1940
        p = psutil.Process()
        files = p.open_files()
        with open(self.get_testfn(), 'w'):
            # give the kernel some time to see the new file
            call_until(p.open_files, "len(ret) != %i" % len(files))
            patch_point = 'psutil._pslinux.os.readlink'
>           with mock.patch(
                patch_point, side_effect=OSError(errno.ENAMETOOLONG, "")
            ) as m:

psutil/tests/test_linux.py:2012:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
___________________________________________________________________________ TestProcess.test_open_files_file_gone ___________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_open_files_file_gone>

    def test_open_files_file_gone(self):
        # simulates a file which gets deleted during open_files()
        # execution
        p = psutil.Process()
        files = p.open_files()
        with open(self.get_testfn(), 'w'):
            # give the kernel some time to see the new file
            call_until(p.open_files, "len(ret) != %i" % len(files))
>           with mock.patch(
                'psutil._pslinux.os.readlink',
                side_effect=OSError(errno.ENOENT, ""),
            ) as m:

psutil/tests/test_linux.py:1971:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_______________________________________________________________________ TestProcess.test_readlink_path_deleted_mocked _______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_readlink_path_deleted_mocked>

    def test_readlink_path_deleted_mocked(self):
>       with mock.patch(
            'psutil._pslinux.os.readlink', return_value='/home/foo (deleted)'
        ):

psutil/tests/test_linux.py:2080:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
______________________________________________________________________________ TestProcess.test_rlimit_zombie _______________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_rlimit_zombie>

    @unittest.skipIf(not HAS_RLIMIT, "not supported")
    def test_rlimit_zombie(self):
        # Emulate a case where rlimit() raises ENOSYS, which may
        # happen in case of zombie process:
        # https://travis-ci.org/giampaolo/psutil/jobs/51368273
>       with mock.patch(
            "psutil._pslinux.prlimit", side_effect=OSError(errno.ENOSYS, "")
        ) as m1:

psutil/tests/test_linux.py:2139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_____________________________________________________________________________ TestProcess.test_terminal_mocked ______________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcess testMethod=test_terminal_mocked>

    def test_terminal_mocked(self):
>       with mock.patch(
            'psutil._pslinux._psposix.get_terminal_map', return_value={}
        ) as m:

psutil/tests/test_linux.py:2022:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________ TestProcessAgainstStatus.test_cpu_affinity_eligible_cpus __________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_linux.TestProcessAgainstStatus testMethod=test_cpu_affinity_eligible_cpus>

    def test_cpu_affinity_eligible_cpus(self):
        value = self.read_status_file("Cpus_allowed_list:")
>       with mock.patch("psutil._pslinux.per_cpu_times") as m:

psutil/tests/test_linux.py:2326:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_pslinux', import_path = 'psutil._pslinux'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_pslinux'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
____________________________________________________________________________ TestMisc.test_sanity_version_check _____________________________________________________________________________

self = <psutil.tests.test_misc.TestMisc testMethod=test_sanity_version_check>

    def test_sanity_version_check(self):
        # see: https://github.com/giampaolo/psutil/issues/564
        with mock.patch(
            "psutil._psplatform.cext.version", return_value="0.0.0"
        ):
            with self.assertRaises(ImportError) as cm:
                reload_module(psutil)
>           self.assertIn("version conflict", str(cm.exception).lower())
E           AssertionError: 'version conflict' not found in 'module psutil not in sys.modules'

psutil/tests/test_misc.py:320: AssertionError
________________________________________________________________________________ TestCommonModule.test_debug ________________________________________________________________________________

self = <psutil.tests.test_misc.TestCommonModule testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError

psutil/tests/test_misc.py:581: AssertionError
_______________________________________________________________________ TestSystemAPIs.test_os_waitpid_bad_ret_status _______________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_posix.TestSystemAPIs testMethod=test_os_waitpid_bad_ret_status>

    def test_os_waitpid_bad_ret_status(self):
        # Simulate os.waitpid() returning a bad status.
>       with mock.patch(
            "psutil._psposix.os.waitpid", return_value=(1, -1)
        ) as m:

psutil/tests/test_posix.py:430:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
___________________________________________________________________________ TestSystemAPIs.test_os_waitpid_eintr ____________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_posix.TestSystemAPIs testMethod=test_os_waitpid_eintr>

    def test_os_waitpid_eintr(self):
        # os.waitpid() is supposed to "retry" on EINTR.
>       with mock.patch(
            "psutil._psposix.os.waitpid", side_effect=OSError(errno.EINTR, "")
        ) as m:

psutil/tests/test_posix.py:417:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________________ TestSystemAPIs.test_os_waitpid_let_raise __________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_posix.TestSystemAPIs testMethod=test_os_waitpid_let_raise>

    def test_os_waitpid_let_raise(self):
        # os.waitpid() is supposed to catch EINTR and ECHILD only.
        # Test that any other errno results in an exception.
>       with mock.patch(
            "psutil._psposix.os.waitpid", side_effect=OSError(errno.EBADF, "")
        ) as m:

psutil/tests/test_posix.py:409:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________________ TestSystemAPIs.test_pid_exists_let_raise __________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_posix.TestSystemAPIs testMethod=test_pid_exists_let_raise>

    def test_pid_exists_let_raise(self):
        # According to "man 2 kill" possible error values for kill
        # are (EINVAL, EPERM, ESRCH). Test that any other errno
        # results in an exception.
>       with mock.patch(
            "psutil._psposix.os.kill", side_effect=OSError(errno.EBADF, "")
        ) as m:

psutil/tests/test_posix.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = '_psposix', import_path = 'psutil._psposix'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute '_psposix'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_________________________________________________________________________________ TestProcess.test_as_dict __________________________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_as_dict>

    def test_as_dict(self):
        p = psutil.Process()
        d = p.as_dict(attrs=['exe', 'name'])
        self.assertEqual(sorted(d.keys()), ['exe', 'name'])

        p = psutil.Process(min(psutil.pids()))
        d = p.as_dict(attrs=['connections'], ad_value='foo')
        if not isinstance(d['connections'], list):
            self.assertEqual(d['connections'], 'foo')

        # Test ad_value is set on AccessDenied.
        with mock.patch(
            'psutil.Process.nice', create=True, side_effect=psutil.AccessDenied
        ):
>           self.assertEqual(
                p.as_dict(attrs=["nice"], ad_value=1), {"nice": 1}
            )
E           AssertionError: {'nice': 0} != {'nice': 1}
E           - {'nice': 0}
E           ?          ^
E
E           + {'nice': 1}
E           ?          ^

psutil/tests/test_process.py:1218: AssertionError
_________________________________________________________________________ TestProcess.test_cpu_percent_numcpus_none _________________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_cpu_percent_numcpus_none>

    def test_cpu_percent_numcpus_none(self):
        # See: https://github.com/giampaolo/psutil/issues/1087
        with mock.patch('psutil.cpu_count', return_value=None) as m:
            psutil.Process().cpu_percent()
>           assert m.called
E           AssertionError

psutil/tests/test_process.py:253: AssertionError
_________________________________________________________________________________ TestProcess.test_terminal _________________________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/tests/__init__.py:345: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['tty'], kwds = {'creationflags': 0, 'stderr': -1, 'stdout': -1, 'universal_newlines': True}, flags = 0, p = <Popen: returncode: 1 args: ['tty']>, stdout = 'not a tty\n', stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """Run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS else 0
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        if isinstance(cmd, str):
            cmd = shlex.split(cmd)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.8-2.fc36.x86_64/usr/lib64/python3.9/site-packages/psutil/tests/__init__.py:519: RuntimeError
_____________________________________________________________________ TestProcess.test_zombie_process_is_running_w_exc ______________________________________________________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_zombie_process_is_running_w_exc>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_zombie_process_is_running_w_exc(self):
        # Emulate a case where internally is_running() raises
        # ZombieProcess.
        p = psutil.Process()
        with mock.patch(
            "psutil.Process", side_effect=psutil.ZombieProcess(0)
        ) as m:
            assert p.is_running()
>           assert m.called
E           AssertionError

psutil/tests/test_process.py:1359: AssertionError
_____________________________________________________________________________ TestProcessAPIs.test_process_iter _____________________________________________________________________________

self = <psutil.tests.test_system.TestProcessAPIs testMethod=test_process_iter>

    def test_process_iter(self):
        self.assertIn(os.getpid(), [x.pid for x in psutil.process_iter()])
        sproc = self.spawn_testproc()
        self.assertIn(sproc.pid, [x.pid for x in psutil.process_iter()])
        p = psutil.Process(sproc.pid)
        p.kill()
        p.wait()
        self.assertNotIn(sproc.pid, [x.pid for x in psutil.process_iter()])

        # assert there are no duplicates
        ls = [x for x in psutil.process_iter()]
        self.assertEqual(
            sorted(ls, key=lambda x: x.pid),
            sorted(set(ls), key=lambda x: x.pid),
        )

        with mock.patch(
            'psutil.Process', side_effect=psutil.NoSuchProcess(os.getpid())
        ):
>           self.assertEqual(list(psutil.process_iter()), [])
E           AssertionError: Lists differ: [psutil.Process(pid=1, name='systemd', sta[3951 chars]37')] != []
E
E           First list contains 44 additional elements.
E           First extra element 0:
E           psutil.Process(pid=1, name='systemd', status='sleeping', started='2024-03-08 00:16:30')
E
E           Diff is 4135 characters long. Set self.maxDiff to None to see it.

psutil/tests/test_system.py:84: AssertionError
_____________________________________________________________________________ TestDiskAPIs.test_disk_partitions _____________________________________________________________________________

self = <psutil.tests.test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device  # noqa
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [
            x.mountpoint.lower()
            for x in psutil.disk_partitions(all=True)
            if x.mountpoint
        ]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/var/lib/systemd/coredump', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/devices/virtual/net', '/sys/fs/fuse/connections', '/sys/fs/cgroup', '/dev/pts', '/dev/ptmx', '/dev/lxc/console', '/dev/console', '/dev/lxc/tty1', '/dev/lxc/tty2', '/dev/lxc/tty3', '/dev/lxc/tty4', '/proc/sys/kernel/random/boot_id', '/dev/shm', '/run', '/dev/mqueue', '/tmp', '/run/user/1000']

psutil/tests/test_system.py:702: AssertionError
_______________________________________________________________________ TestSyncTestUtils.test_wait_for_file_no_file ________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_testutils.TestSyncTestUtils testMethod=test_wait_for_file_no_file>

    def test_wait_for_file_no_file(self):
        testfn = self.get_testfn()
>       with mock.patch('psutil.tests.retry.__iter__', return_value=iter([0])):

psutil/tests/test_testutils.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
____________________________________________________________________________ TestSyncTestUtils.test_wait_for_pid ____________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_testutils.TestSyncTestUtils testMethod=test_wait_for_pid>

    def test_wait_for_pid(self):
        wait_for_pid(os.getpid())
        nopid = max(psutil.pids()) + 99999
>       with mock.patch('psutil.tests.retry.__iter__', return_value=iter([0])):

psutil/tests/test_testutils.py:131:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
_____________________________________________________________________________ TestFSTestUtils.test_safe_rmpath ______________________________________________________________________________

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1226: AttributeError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_testutils.TestFSTestUtils testMethod=test_safe_rmpath>

    def test_safe_rmpath(self):
        # test file is removed
        testfn = self.get_testfn()
        open(testfn, 'w').close()
        safe_rmpath(testfn)
        assert not os.path.exists(testfn)
        # test no exception if path does not exist
        safe_rmpath(testfn)
        # test dir is removed
        os.mkdir(testfn)
        safe_rmpath(testfn)
        assert not os.path.exists(testfn)
        # test other exceptions are raised
>       with mock.patch(
            'psutil.tests.os.stat', side_effect=OSError(errno.EINVAL, "")
        ) as m:

psutil/tests/test_testutils.py:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.9/unittest/mock.py:1388: in __enter__
    self.target = self.getter()
/usr/lib64/python3.9/unittest/mock.py:1563: in <lambda>
    getter = lambda: _importer(target)
/usr/lib64/python3.9/unittest/mock.py:1239: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

thing = <module 'psutil' from '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py'>, comp = 'tests', import_path = 'psutil.tests'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
            __import__(import_path)
>           return getattr(thing, comp)
E           AttributeError: module 'psutil' has no attribute 'tests'

/usr/lib64/python3.9/unittest/mock.py:1229: AttributeError
================================================================================== short test summary info ==================================================================================
SKIPPED [1] psutil/tests/test_aix.py:121: AIX only
SKIPPED [1] psutil/tests/test_aix.py:81: AIX only
SKIPPED [1] psutil/tests/test_aix.py:127: AIX only
SKIPPED [1] psutil/tests/test_aix.py:56: AIX only
SKIPPED [1] psutil/tests/test_aix.py:22: AIX only
SKIPPED [1] psutil/tests/test_bsd.py:125: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:98: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:136: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:88: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:130: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:187: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:227: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:207: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:181: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:166: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:194: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:438: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:263: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:382: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:389: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:396: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:403: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:334: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:374: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:358: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:366: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:342: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:329: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:350: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:447: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:467: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:482: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:495: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:418: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:430: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:424: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:285: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:320: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:306: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:313: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:292: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:299: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:525: OPENBSD only
SKIPPED [1] psutil/tests/test_bsd.py:616: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:604: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:591: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:584: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:598: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:561: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:575: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:554: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:568: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:549: NETBSD only
SKIPPED [1] psutil/tests/test_linux.py:1719: no battery
SKIPPED [1] psutil/tests/test_linux.py:1727: no battery
SKIPPED [1] psutil/tests/test_linux.py:1743: no battery
SKIPPED [1] psutil/tests/test_linux.py:1668: no battery
SKIPPED [1] psutil/tests/test_linux.py:1682: no battery
SKIPPED [1] psutil/tests/test_linux.py:1634: no battery
SKIPPED [1] psutil/tests/test_linux.py:1651: no battery
SKIPPED [1] psutil/tests/test_linux.py:1699: no battery
SKIPPED [1] psutil/tests/test_linux.py:1627: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:169: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:265: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:154: worthless on POSIX
SKIPPED [1] psutil/tests/test_memleaks.py:329: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:326: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:376: WINDOWS only
SKIPPED [1] psutil/tests/test_misc.py:1000: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:907: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:985: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:928: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:919: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:994: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:931: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:953: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:974: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:965: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:934: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:950: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:968: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:977: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:956: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:937: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:960: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:944: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:947: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:1005: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:988: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:971: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:940: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:981: can't locate scripts directory
SKIPPED [1] psutil/tests/test_osx.py:64: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:118: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:114: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:123: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:83: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:182: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:196: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:168: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:174: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:148: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:142: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:154: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:138: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:160: MACOS only
SKIPPED [1] psutil/tests/test_process.py:401: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:531: WINDOWS only
SKIPPED [1] psutil/tests/test_sunos.py:37: SUNOS only
SKIPPED [1] psutil/tests/test_sunos.py:20: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:631: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:937: no battery
SKIPPED [1] psutil/tests/test_windows.py:129: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:122: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:115: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:105: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:134: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:139: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:290: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:300: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:265: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:248: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:217: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:164: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:278: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:147: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:182: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:207: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:158: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:172: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:346: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:363: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:354: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:372: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:318: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:324: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:335: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:455: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:533: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:433: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:591: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:601: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:547: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:397: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:490: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:481: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:573: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:422: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:418: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:401: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:446: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:522: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:634: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:666: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:626: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:646: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:653: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:620: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:639: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:760: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:721: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:712: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:736: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:698: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:749: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:832: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:837: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:842: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:846: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:850: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:856: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:915: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:871: WINDOWS only
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstFree::test_used - AssertionError: 6152015872 != 5317611520 within 5242880 delta (834404352 difference)
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstVmstat::test_used - AssertionError: 6152683520 != 5318025216 within 5242880 delta (834658304 difference)
FAILED psutil/tests/test_linux.py::TestSystemSwapMemory::test_meminfo_against_sysinfo - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemCPUCountLogical::test_emulate_fallbacks - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemCPUFrequency::test_emulate_multi_cpu - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemCPUFrequency::test_emulate_no_scaling_cur_freq_file - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemCPUFrequency::test_emulate_use_cpuinfo - ImportError: module psutil not in sys.modules
FAILED psutil/tests/test_linux.py::TestSystemNetConnections::test_emulate_ipv6_unsupported - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskPartitions::test_zfs_fs - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_exclude_partitions - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_include_partitions - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_kernel_2_4 - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_kernel_2_6_full - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_kernel_2_6_limited - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_not_impl - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestSystemDiskIoCounters::test_emulate_use_sysfs - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt - AssertionError: None != '/dev/nvme0n1p2[/lxc/pers-jacek/rootfs]'
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons - AssertionError: unexpectedly None
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestMisc::test_no_procfs_on_import - ImportError: module psutil not in sys.modules
FAILED psutil/tests/test_linux.py::TestMisc::test_procfs_path - AssertionError: OSError not raised by virtual_memory
FAILED psutil/tests/test_linux.py::TestProcess::test_connections_enametoolong - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_exe_mocked - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_open_files_enametoolong - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_open_files_file_gone - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_readlink_path_deleted_mocked - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_rlimit_zombie - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcess::test_terminal_mocked - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_linux.py::TestProcessAgainstStatus::test_cpu_affinity_eligible_cpus - AttributeError: module 'psutil' has no attribute '_pslinux'
FAILED psutil/tests/test_misc.py::TestMisc::test_sanity_version_check - AssertionError: 'version conflict' not found in 'module psutil not in sys.modules'
FAILED psutil/tests/test_misc.py::TestCommonModule::test_debug - AssertionError
FAILED psutil/tests/test_posix.py::TestSystemAPIs::test_os_waitpid_bad_ret_status - AttributeError: module 'psutil' has no attribute '_psposix'
FAILED psutil/tests/test_posix.py::TestSystemAPIs::test_os_waitpid_eintr - AttributeError: module 'psutil' has no attribute '_psposix'
FAILED psutil/tests/test_posix.py::TestSystemAPIs::test_os_waitpid_let_raise - AttributeError: module 'psutil' has no attribute '_psposix'
FAILED psutil/tests/test_posix.py::TestSystemAPIs::test_pid_exists_let_raise - AttributeError: module 'psutil' has no attribute '_psposix'
FAILED psutil/tests/test_process.py::TestProcess::test_as_dict - AssertionError: {'nice': 0} != {'nice': 1}
FAILED psutil/tests/test_process.py::TestProcess::test_cpu_percent_numcpus_none - AssertionError
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_process.py::TestProcess::test_zombie_process_is_running_w_exc - AssertionError
FAILED psutil/tests/test_system.py::TestProcessAPIs::test_process_iter - AssertionError: Lists differ: [psutil.Process(pid=1, name='systemd', sta[3951 chars]37')] != []
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/var/lib/systemd/coredump', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/d...
FAILED psutil/tests/test_testutils.py::TestSyncTestUtils::test_wait_for_file_no_file - AttributeError: module 'psutil' has no attribute 'tests'
FAILED psutil/tests/test_testutils.py::TestSyncTestUtils::test_wait_for_pid - AttributeError: module 'psutil' has no attribute 'tests'
FAILED psutil/tests/test_testutils.py::TestFSTestUtils::test_safe_rmpath - AttributeError: module 'psutil' has no attribute 'tests'
======================================================================= 44 failed, 448 passed, 176 skipped in 18.81s ========================================================================

@kloczek
Copy link
Author

kloczek commented Apr 3, 2024

4.9.8, python 3.10 and pytest 8.1.1

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly --import-mode=importlib
============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8
configfile: pyproject.toml
collected 668 items

psutil/tests/test_aix.py sssss                                           [  0%]
psutil/tests/test_bsd.py sssssssssssssssssssssssssssssssssssssssssssssss [  7%]
s                                                                        [  7%]
psutil/tests/test_connections.py .................                       [ 10%]
psutil/tests/test_contracts.py .......................................   [ 16%]
psutil/tests/test_linux.py ....F.....F..............................Fss. [ 23%]
s............F.FF........sssssssss........F.......................       [ 32%]
psutil/tests/test_memleaks.py .......................s...s.......s...... [ 39%]
.................s...s.......sss..........s..............                [ 47%]
psutil/tests/test_misc.py ...............F............F................. [ 54%]
ssssssssssssssssssssssss                                                 [ 58%]
psutil/tests/test_osx.py ssssssssssssss                                  [ 60%]
psutil/tests/test_posix.py ................s.....ss.                     [ 64%]
psutil/tests/test_process.py .......................s.............s..... [ 70%]
...................F.................                                    [ 76%]
psutil/tests/test_process_all.py .                                       [ 76%]
psutil/tests/test_sunos.py ss                                            [ 76%]
psutil/tests/test_system.py .........F....................F..s......s... [ 83%]
                                                                         [ 83%]
psutil/tests/test_testutils.py .................................         [ 88%]
psutil/tests/test_unicode.py ...................                         [ 90%]
psutil/tests/test_windows.py sssssssssssssssssssssssssssssssssssssssssss [ 97%]
ssssssssssssssssss                                                       [100%]

=================================== FAILURES ===================================
_________________ TestSystemVirtualMemoryAgainstFree.test_used _________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstFree testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        cli_value = free_physmem().used
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            cli_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 8236376064 != 7279325184 within 5242880 delta (957050880 difference)

psutil/tests/test_linux.py:284: AssertionError
----------------------------- Captured stderr call -----------------------------
AssertionError('8246009856 != 7288950784 within 5242880 delta (957059072 difference)'), retrying
AssertionError('8246009856 != 7288950784 within 5242880 delta (957059072 difference)'), retrying
AssertionError('8245673984 != 7288614912 within 5242880 delta (957059072 difference)'), retrying
AssertionError('8245673984 != 7288356864 within 5242880 delta (957317120 difference)'), retrying
AssertionError('8245415936 != 7288356864 within 5242880 delta (957059072 difference)'), retrying
AssertionError('8244523008 != 7287463936 within 5242880 delta (957059072 difference)'), retrying
AssertionError('8236265472 != 7279214592 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8236118016 != 7279067136 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8236376064 != 7279325184 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8236376064 != 7279325184 within 5242880 delta (957050880 difference)'), retrying
________________ TestSystemVirtualMemoryAgainstVmstat.test_used ________________

self = <psutil.tests.test_linux.TestSystemVirtualMemoryAgainstVmstat testMethod=test_used>

    @retry_on_failure()
    def test_used(self):
        # Older versions of procps used slab memory to calculate used memory.
        # This got changed in:
        # https://gitlab.com/procps-ng/procps/commit/
        #     05d751c4f076a2f0118b914c5e51cfbb4762ad8e
        if get_free_version_info() < (3, 3, 12):
            raise self.skipTest("old free version")
        vmstat_value = vmstat('used memory') * 1024
        psutil_value = psutil.virtual_memory().used
>       self.assertAlmostEqual(
            vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM
        )
E       AssertionError: 8243572736 != 7286521856 within 5242880 delta (957050880 difference)

psutil/tests/test_linux.py:348: AssertionError
----------------------------- Captured stderr call -----------------------------
AssertionError('8242589696 != 7285538816 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243326976 != 7286276096 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243326976 != 7286276096 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243326976 != 7286276096 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
AssertionError('8243572736 != 7286521856 within 5242880 delta (957050880 difference)'), retrying
________________________ TestSystemNetIfAddrs.test_ips _________________________

self = <psutil.tests.test_linux.TestSystemNetIfAddrs testMethod=test_ips>

    def test_ips(self):
        for name, addrs in psutil.net_if_addrs().items():
            for addr in addrs:
                if addr.family == psutil.AF_LINK:
>                   self.assertEqual(addr.address, get_mac_address(name))
E                   AssertionError: '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00' != '00:00:00:00:00:00'
E                   - 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
E                   + 00:00:00:00:00:00

psutil/tests/test_linux.py:1003: AssertionError
_________________ TestRootFsDeviceFinder.test_against_findmnt __________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_against_findmnt>

    @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_against_findmnt(self):
        psutil_value = RootFsDeviceFinder().find()
        findmnt_value = sh("findmnt -o SOURCE -rn /")
>       self.assertEqual(psutil_value, findmnt_value)
E       AssertionError: None != '/dev/nvme0n1p2[/lxc/devel-g2v/rootfs]'

psutil/tests/test_linux.py:1433: AssertionError
___________________ TestRootFsDeviceFinder.test_comparisons ____________________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_comparisons>

    @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
    def test_comparisons(self):
        finder = RootFsDeviceFinder()
>       self.assertIsNotNone(finder.find())
E       AssertionError: unexpectedly None

psutil/tests/test_linux.py:1409: AssertionError
______________ TestRootFsDeviceFinder.test_disk_partitions_mocked ______________

self = <psutil.tests.test_linux.TestRootFsDeviceFinder testMethod=test_disk_partitions_mocked>

    def test_disk_partitions_mocked(self):
        with mock.patch(
            'psutil._pslinux.cext.disk_partitions',
            return_value=[('/dev/root', '/', 'ext4', 'rw')],
        ) as m:
            part = psutil.disk_partitions()[0]
            assert m.called
            if not GITHUB_ACTIONS:
>               self.assertNotEqual(part.device, "/dev/root")
E               AssertionError: '/dev/root' == '/dev/root'

psutil/tests/test_linux.py:1443: AssertionError
_________________________ TestProcess.test_exe_mocked __________________________

self = <psutil.tests.test_linux.TestProcess testMethod=test_exe_mocked>

    def test_exe_mocked(self):
        with mock.patch(
            'psutil._pslinux.readlink', side_effect=OSError(errno.ENOENT, "")
        ) as m:
            ret = psutil.Process().exe()
            assert m.called
>           self.assertEqual(ret, "")
E           AssertionError: '/usr/bin/python3' != ''
E           - /usr/bin/python3
E           +

psutil/tests/test_linux.py:2120: AssertionError
_____________________________ TestMisc.test__all__ _____________________________

self = <psutil.tests.test_misc.TestMisc testMethod=test__all__>

    def test__all__(self):
        dir_psutil = dir(psutil)
        for name in dir_psutil:
            if name in (
                'long',
                'tests',
                'test',
                'PermissionError',
                'ProcessLookupError',
            ):
                continue
            if not name.startswith('_'):
                try:
>                   __import__(name)
E                   ModuleNotFoundError: No module named 'memoize_when_activated'

psutil/tests/test_misc.py:229: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <psutil.tests.test_misc.TestMisc testMethod=test__all__>

    def test__all__(self):
        dir_psutil = dir(psutil)
        for name in dir_psutil:
            if name in (
                'long',
                'tests',
                'test',
                'PermissionError',
                'ProcessLookupError',
            ):
                continue
            if not name.startswith('_'):
                try:
                    __import__(name)
                except ImportError:
                    if name not in psutil.__all__:
                        fun = getattr(psutil, name)
                        if fun is None:
                            continue
                        if (
                            fun.__doc__ is not None
                            and 'deprecated' not in fun.__doc__.lower()
                        ):
>                           raise self.fail('%r not in psutil.__all__' % name)
E                           AssertionError: 'memoize_when_activated' not in psutil.__all__

psutil/tests/test_misc.py:239: AssertionError
_________________________ TestCommonModule.test_debug __________________________

self = <psutil.tests.test_misc.TestCommonModule testMethod=test_debug>

    def test_debug(self):
        if PY3:
            from io import StringIO
        else:
            from StringIO import StringIO

        with redirect_stderr(StringIO()) as f:
            debug("hello")
        msg = f.getvalue()
>       assert msg.startswith("psutil-debug"), msg
E       AssertionError

psutil/tests/test_misc.py:580: AssertionError
__________________________ TestProcess.test_terminal ___________________________

self = <psutil.tests.test_process.TestProcess testMethod=test_terminal>

    @unittest.skipIf(not POSIX, 'POSIX only')
    def test_terminal(self):
        terminal = psutil.Process().terminal()
        if terminal is not None:
>           tty = os.path.realpath(sh('tty'))

psutil/tests/test_process.py:310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-psutil-5.9.8-2.fc37.x86_64/usr/lib64/python3.10/site-packages/psutil/tests/__init__.py:342: in wrapper
    return fun(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['tty']
kwds = {'creationflags': 0, 'stderr': -1, 'stdout': -1, 'universal_newlines': True}
flags = 0, p = <Popen: returncode: 1 args: ['tty']>, stdout = 'not a tty\n'
stderr = ''

    @_reap_children_on_err
    def sh(cmd, **kwds):
        """Run cmd in a subprocess and return its output.
        raises RuntimeError on error.
        """
        # Prevents subprocess to open error dialogs in case of error.
        flags = 0x8000000 if WINDOWS else 0
        kwds.setdefault("stdout", subprocess.PIPE)
        kwds.setdefault("stderr", subprocess.PIPE)
        kwds.setdefault("universal_newlines", True)
        kwds.setdefault("creationflags", flags)
        if isinstance(cmd, str):
            cmd = shlex.split(cmd)
        p = subprocess.Popen(cmd, **kwds)
        _subprocesses_started.add(p)
        if PY3:
            stdout, stderr = p.communicate(timeout=GLOBAL_TIMEOUT)
        else:
            stdout, stderr = p.communicate()
        if p.returncode != 0:
>           raise RuntimeError(stderr)
E           RuntimeError

../../BUILDROOT/python-psutil-5.9.8-2.fc37.x86_64/usr/lib64/python3.10/site-packages/psutil/tests/__init__.py:516: RuntimeError
___________________________ TestMiscAPIs.test_users ____________________________

self = <psutil.tests.test_system.TestMiscAPIs testMethod=test_users>

    @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
    def test_users(self):
        users = psutil.users()
>       self.assertNotEqual(users, [])
E       AssertionError: [] == []

psutil/tests/test_system.py:223: AssertionError
______________________ TestDiskAPIs.test_disk_partitions _______________________

self = <psutil.tests.test_system.TestDiskAPIs testMethod=test_disk_partitions>

    def test_disk_partitions(self):
        def check_ntuple(nt):
            self.assertIsInstance(nt.device, str)
            self.assertIsInstance(nt.mountpoint, str)
            self.assertIsInstance(nt.fstype, str)
            self.assertIsInstance(nt.opts, str)
            self.assertIsInstance(nt.maxfile, (int, type(None)))
            self.assertIsInstance(nt.maxpath, (int, type(None)))
            if nt.maxfile is not None and not GITHUB_ACTIONS:
                self.assertGreater(nt.maxfile, 0)
            if nt.maxpath is not None:
                self.assertGreater(nt.maxpath, 0)

        # all = False
        ls = psutil.disk_partitions(all=False)
        self.assertTrue(ls, msg=ls)
        for disk in ls:
            check_ntuple(disk)
            if WINDOWS and 'cdrom' in disk.opts:
                continue
            if not POSIX:
                assert os.path.exists(disk.device), disk
            else:
                # we cannot make any assumption about this, see:
                # http://goo.gl/p9c43
                disk.device  # noqa
            # on modern systems mount points can also be files
            assert os.path.exists(disk.mountpoint), disk
            assert disk.fstype, disk

        # all = True
        ls = psutil.disk_partitions(all=True)
        self.assertTrue(ls, msg=ls)
        for disk in psutil.disk_partitions(all=True):
            check_ntuple(disk)
            if not WINDOWS and disk.mountpoint:
                try:
                    os.stat(disk.mountpoint)
                except OSError as err:
                    if GITHUB_ACTIONS and MACOS and err.errno == errno.EIO:
                        continue
                    # http://mail.python.org/pipermail/python-dev/
                    #     2012-June/120787.html
                    if err.errno not in (errno.EPERM, errno.EACCES):
                        raise
                else:
                    assert os.path.exists(disk.mountpoint), disk

        # ---

        def find_mount_point(path):
            path = os.path.abspath(path)
            while not os.path.ismount(path):
                path = os.path.dirname(path)
            return path.lower()

        mount = find_mount_point(__file__)
        mounts = [
            x.mountpoint.lower()
            for x in psutil.disk_partitions(all=True)
            if x.mountpoint
        ]
>       self.assertIn(mount, mounts)
E       AssertionError: '/home/tkloczko/rpmbuild' not found in ['/', '/home', '/dev', '/proc', '/proc/sys/net', '/proc/sys', '/proc/sysrq-trigger', '/sys', '/sys/devices/virtual/net', '/sys/fs/fuse/connections', '/sys/fs/cgroup', '/dev/pts', '/dev/ptmx', '/dev/lxc/console', '/dev/console', '/dev/lxc/tty1', '/dev/lxc/tty2', '/dev/lxc/tty3', '/dev/lxc/tty4', '/proc/sys/kernel/random/boot_id', '/dev/shm', '/run', '/dev/mqueue', '/tmp', '/run/user/1000']

psutil/tests/test_system.py:702: AssertionError
=========================== short test summary info ============================
SKIPPED [1] psutil/tests/test_aix.py:121: AIX only
SKIPPED [1] psutil/tests/test_aix.py:81: AIX only
SKIPPED [1] psutil/tests/test_aix.py:127: AIX only
SKIPPED [1] psutil/tests/test_aix.py:56: AIX only
SKIPPED [1] psutil/tests/test_aix.py:22: AIX only
SKIPPED [1] psutil/tests/test_bsd.py:125: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:98: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:136: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:88: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:130: BSD only
SKIPPED [1] psutil/tests/test_bsd.py:187: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:227: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:207: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:181: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:166: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:194: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:438: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:263: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:382: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:389: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:396: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:403: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:334: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:374: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:358: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:366: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:342: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:329: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:350: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:447: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:467: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:482: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:495: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:418: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:430: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:424: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:285: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:320: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:306: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:313: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:292: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:299: FREEBSD only
SKIPPED [1] psutil/tests/test_bsd.py:525: OPENBSD only
SKIPPED [1] psutil/tests/test_bsd.py:616: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:604: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:591: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:584: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:598: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:561: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:575: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:554: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:568: NETBSD only
SKIPPED [1] psutil/tests/test_bsd.py:549: NETBSD only
SKIPPED [1] psutil/tests/test_linux.py:1041: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1059: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1092: ifconfig utility not available
SKIPPED [1] psutil/tests/test_linux.py:1718: no battery
SKIPPED [1] psutil/tests/test_linux.py:1726: no battery
SKIPPED [1] psutil/tests/test_linux.py:1742: no battery
SKIPPED [1] psutil/tests/test_linux.py:1667: no battery
SKIPPED [1] psutil/tests/test_linux.py:1681: no battery
SKIPPED [1] psutil/tests/test_linux.py:1633: no battery
SKIPPED [1] psutil/tests/test_linux.py:1650: no battery
SKIPPED [1] psutil/tests/test_linux.py:1698: no battery
SKIPPED [1] psutil/tests/test_linux.py:1626: no battery
SKIPPED [2] psutil/tests/test_memleaks.py:168: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:264: WINDOWS only
SKIPPED [2] psutil/tests/test_memleaks.py:153: worthless on POSIX
SKIPPED [1] psutil/tests/test_memleaks.py:328: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:325: WINDOWS only
SKIPPED [1] psutil/tests/test_memleaks.py:375: WINDOWS only
SKIPPED [1] psutil/tests/test_misc.py:999: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:906: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:984: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:927: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:918: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:993: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:930: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:952: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:973: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:964: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:933: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:949: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:967: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:976: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:955: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:936: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:959: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:943: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:946: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:1004: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:987: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:970: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:939: can't locate scripts directory
SKIPPED [1] psutil/tests/test_misc.py:980: can't locate scripts directory
SKIPPED [1] psutil/tests/test_osx.py:64: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:118: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:114: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:123: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:83: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:182: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:196: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:168: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:174: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:148: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:142: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:154: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:138: MACOS only
SKIPPED [1] psutil/tests/test_osx.py:160: MACOS only
SKIPPED [1] psutil/tests/test_posix.py:324: no ifconfig cmd
SKIPPED [1] psutil/tests/test_posix.py:340: no users on this system
SKIPPED [1] psutil/tests/test_posix.py:356: no users on this system
SKIPPED [1] psutil/tests/test_process.py:401: not supported on this win version
SKIPPED [1] psutil/tests/test_process.py:531: WINDOWS only
SKIPPED [1] psutil/tests/test_sunos.py:37: SUNOS only
SKIPPED [1] psutil/tests/test_sunos.py:20: SUNOS only
SKIPPED [1] psutil/tests/test_system.py:631: not an ASCII fs
SKIPPED [1] psutil/tests/test_system.py:937: no battery
SKIPPED [1] psutil/tests/test_windows.py:128: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:121: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:114: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:104: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:133: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:138: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:289: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:299: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:264: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:247: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:216: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:163: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:277: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:146: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:181: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:206: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:157: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:171: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:345: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:362: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:353: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:371: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:317: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:323: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:334: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:454: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:532: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:432: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:590: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:600: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:546: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:396: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:489: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:480: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:572: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:421: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:417: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:400: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:445: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:521: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:633: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:665: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:625: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:645: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:652: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:619: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:638: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:759: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:720: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:711: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:735: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:697: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:748: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:831: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:836: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:841: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:845: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:849: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:855: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:914: WINDOWS only
SKIPPED [1] psutil/tests/test_windows.py:870: WINDOWS only
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstFree::test_used
FAILED psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstVmstat::test_used
FAILED psutil/tests/test_linux.py::TestSystemNetIfAddrs::test_ips - Assertion...
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons
FAILED psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked
FAILED psutil/tests/test_linux.py::TestProcess::test_exe_mocked - AssertionEr...
FAILED psutil/tests/test_misc.py::TestMisc::test__all__ - AssertionError: 'me...
FAILED psutil/tests/test_misc.py::TestCommonModule::test_debug - AssertionError
FAILED psutil/tests/test_process.py::TestProcess::test_terminal - RuntimeError
FAILED psutil/tests/test_system.py::TestMiscAPIs::test_users - AssertionError...
FAILED psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions - Asse...
================= 12 failed, 474 passed, 182 skipped in 11.53s =================

@kloczek
Copy link
Author

kloczek commented May 27, 2024

Just tested 5.9.8 with pytest 8.2.1 and in this case it is even worse

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-3.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-psutil-5.9.8-3.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly --import-mode=importlib
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8
configfile: pyproject.toml
plugins: subtests-0.12.1, hypothesis-6.100.0
collected 0 items / 16 errors

========================================================================================== ERRORS ===========================================================================================
_________________________________________________________________________ ERROR collecting psutil/tests/test_aix.py _________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_aix.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/__init__.py:102: in <module>
    from . import _pslinux as _psplatform
psutil/_pslinux.py:25: in <module>
    from . import _psutil_linux as cext
E   ImportError: cannot import name '_psutil_linux' from 'psutil' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/__init__.py)
_________________________________________________________________________ ERROR collecting psutil/tests/test_bsd.py _________________________________________________________________________
<frozen importlib._bootstrap_external>:883: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
psutil/tests/__init__.py:210: in <module>
    HAS_CPU_AFFINITY = hasattr(psutil.Process, "cpu_affinity")
E   AttributeError: module 'psutil' has no attribute 'Process'
_____________________________________________________________________ ERROR collecting psutil/tests/test_connections.py _____________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_connections.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_connections.py:30: in <module>
    from psutil.tests import AF_UNIX
E   ImportError: cannot import name 'AF_UNIX' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
______________________________________________________________________ ERROR collecting psutil/tests/test_contracts.py ______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_contracts.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_contracts.py:28: in <module>
    from psutil.tests import HAS_CPU_FREQ
E   ImportError: cannot import name 'HAS_CPU_FREQ' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
________________________________________________________________________ ERROR collecting psutil/tests/test_linux.py ________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_linux.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_linux.py:34: in <module>
    from psutil.tests import HAS_BATTERY
E   ImportError: cannot import name 'HAS_BATTERY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
______________________________________________________________________ ERROR collecting psutil/tests/test_memleaks.py _______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_memleaks.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_memleaks.py:34: in <module>
    from psutil.tests import HAS_CPU_AFFINITY
E   ImportError: cannot import name 'HAS_CPU_AFFINITY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
________________________________________________________________________ ERROR collecting psutil/tests/test_misc.py _________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_misc.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_misc.py:39: in <module>
    from psutil.tests import HAS_BATTERY
E   ImportError: cannot import name 'HAS_BATTERY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_________________________________________________________________________ ERROR collecting psutil/tests/test_osx.py _________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_osx.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_osx.py:17: in <module>
    from psutil.tests import HAS_BATTERY
E   ImportError: cannot import name 'HAS_BATTERY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
________________________________________________________________________ ERROR collecting psutil/tests/test_posix.py ________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_posix.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_posix.py:26: in <module>
    from psutil.tests import HAS_NET_IO_COUNTERS
E   ImportError: cannot import name 'HAS_NET_IO_COUNTERS' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_______________________________________________________________________ ERROR collecting psutil/tests/test_process.py _______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_process.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_process.py:44: in <module>
    from psutil.tests import HAS_CPU_AFFINITY
E   ImportError: cannot import name 'HAS_CPU_AFFINITY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_____________________________________________________________________ ERROR collecting psutil/tests/test_process_all.py _____________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_process_all.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_process_all.py:34: in <module>
    from psutil.tests import VALID_PROC_STATUSES
E   ImportError: cannot import name 'VALID_PROC_STATUSES' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
________________________________________________________________________ ERROR collecting psutil/tests/test_sunos.py ________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_sunos.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_sunos.py:14: in <module>
    from psutil.tests import PsutilTestCase
E   ImportError: cannot import name 'PsutilTestCase' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_______________________________________________________________________ ERROR collecting psutil/tests/test_system.py ________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_system.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_system.py:38: in <module>
    from psutil.tests import DEVNULL
E   ImportError: cannot import name 'DEVNULL' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
______________________________________________________________________ ERROR collecting psutil/tests/test_testutils.py ______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_testutils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_testutils.py:30: in <module>
    from psutil.tests import PYTHON_EXE
E   ImportError: cannot import name 'PYTHON_EXE' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_______________________________________________________________________ ERROR collecting psutil/tests/test_unicode.py _______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_unicode.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_unicode.py:93: in <module>
    from psutil.tests import HAS_ENVIRON
E   ImportError: cannot import name 'HAS_ENVIRON' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
_______________________________________________________________________ ERROR collecting psutil/tests/test_windows.py _______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/test_windows.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
psutil/tests/test_windows.py:30: in <module>
    from psutil.tests import HAS_BATTERY
E   ImportError: cannot import name 'HAS_BATTERY' from 'psutil.tests' (/home/tkloczko/rpmbuild/BUILD/psutil-release-5.9.8/psutil/tests/__init__.py)
================================================================================== short test summary info ==================================================================================
ERROR psutil/tests/test_aix.py
ERROR psutil/tests/test_bsd.py - AttributeError: module 'psutil' has no attribute 'Process'
ERROR psutil/tests/test_connections.py
ERROR psutil/tests/test_contracts.py
ERROR psutil/tests/test_linux.py
ERROR psutil/tests/test_memleaks.py
ERROR psutil/tests/test_misc.py
ERROR psutil/tests/test_osx.py
ERROR psutil/tests/test_posix.py
ERROR psutil/tests/test_process.py
ERROR psutil/tests/test_process_all.py
ERROR psutil/tests/test_sunos.py
ERROR psutil/tests/test_system.py
ERROR psutil/tests/test_testutils.py
ERROR psutil/tests/test_unicode.py
ERROR psutil/tests/test_windows.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 16 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================== 16 errors in 1.28s =====================================================================================

@kloczek kloczek changed the title [Linux] 5.9.0: pytest is failing [Linux] 5.9.8: pytest is failing with pytest 8.2.1 May 27, 2024
@giampaolo
Copy link
Owner

How about make test? It also fails with the same failures?
For the record: psutil test suite uses standard unittest module, and it's meant to be run via make test (even though I would expect it to work also with pytest)

@kloczek
Copy link
Author

kloczek commented May 27, 2024

How about make test? It also fails with the same failures?

Hmm .. but why do you want to maintain own test suite framework? 🤔
Is it any problem with pytest or even unittext?
(pytest handles correctly written unittest based test suite as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants