gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)
(cherry picked from commit
0759cecd9d945dfbac2226febaba51f41195555c)
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com>
Co-authored-by: Kevin Diem <kg.diem@gmail.com>
def get_load_avg(self) -> float | None:
if hasattr(os, 'getloadavg'):
- return os.getloadavg()[0]
+ try:
+ return os.getloadavg()[0]
+ except OSError:
+ pass
if self.win_load_tracker is not None:
return self.win_load_tracker.getloadavg()
return None
--- /dev/null
+: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.