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] Test failure with Python 3.12 beta1 #2258

Closed
thesamesam opened this issue May 24, 2023 · 0 comments · Fixed by #2270
Closed

[Linux] Test failure with Python 3.12 beta1 #2258

thesamesam opened this issue May 24, 2023 · 0 comments · Fixed by #2270

Comments

@thesamesam
Copy link

Summary

  • OS: Gentoo Linux
  • Architecture: 64b-it amd64
  • Psutil version: 5.9.5
  • Python version: Python 3.12.0b1
  • Type: tests

Description

I get the following single test failure with Python 3.12, while this test passes on pypy3.10 (beta)/py3.10/py3.11:

======================================================================
FAIL: psutil.tests.test_system.TestCpuAPIs.test_per_cpu_times
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/psutil-5.9.5/work/psutil-5.9.5/psutil/tests/test_system.py", line 393, in test_per_cpu_times
    self.assertEqual(total, sum(times))
AssertionError: 111881.49000000002 != 111881.49

I've not really got that far with debugging it because the noise from the changing values makes it difficult, but this reproduces it too w/ py3.12:

import psutil

def test_per_cpu_times():
        # Check type, value >= 0, str().
        for times in psutil.cpu_times(percpu=True):
                total = 0
                sum(times)
                for cp_time in times:
                        #assertIsInstance(cp_time, float)
                        print(cp_time)
                        assert cp_time >= 0.0
                        total += cp_time
                print(total)
                print(times)
                print(sum(times))
                assert total == sum(times)
                str(times)
        print(len(psutil.cpu_times(percpu=True)[0]))
        print(len(psutil.cpu_times(percpu=False)))
        assert len(psutil.cpu_times(percpu=True)[0]) == len(psutil.cpu_times(percpu=False))

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

Successfully merging a pull request may close this issue.

1 participant