gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)

Co-Authored-By: Kevin Diem <kg.diem@gmail.com>
This commit is contained in:
Bas Bloemsaat 2024-07-13 11:52:08 +02:00 committed by GitHub
parent 4e36dd7d87
commit 0759cecd9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -43,7 +43,10 @@ class Logger:
def get_load_avg(self) -> float | None:
if hasattr(os, 'getloadavg'):
try:
return os.getloadavg()[0]
except OSError:
pass
if self.win_load_tracker is not None:
return self.win_load_tracker.getloadavg()
return None

View File

@ -0,0 +1,3 @@
:func:`os.getloadavg` may throw :exc:`OSError` when running regression tests
under certain conditions (e.g. chroot). This error is now caught and
ignored, since reporting load average is optional.