mirror of
https://github.com/python/cpython.git
synced 2025-08-12 04:49:01 +00:00
[3.12] gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663) (GH-121670)
gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)
(cherry picked from commit 0759cecd9d
)
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com>
Co-authored-by: Kevin Diem <kg.diem@gmail.com>
This commit is contained in:
parent
0ec761a96a
commit
32bbc36796
2 changed files with 7 additions and 1 deletions
|
@ -43,7 +43,10 @@ class Logger:
|
||||||
|
|
||||||
def get_load_avg(self) -> float | None:
|
def get_load_avg(self) -> float | None:
|
||||||
if hasattr(os, 'getloadavg'):
|
if hasattr(os, 'getloadavg'):
|
||||||
return os.getloadavg()[0]
|
try:
|
||||||
|
return os.getloadavg()[0]
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
if self.win_load_tracker is not None:
|
if self.win_load_tracker is not None:
|
||||||
return self.win_load_tracker.getloadavg()
|
return self.win_load_tracker.getloadavg()
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -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.
|
Loading…
Add table
Add a link
Reference in a new issue