Skip to content

Commit 0759cec

Browse files
basbloemsaatkgdiem
andauthored
gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)
Co-Authored-By: Kevin Diem <[email protected]>
1 parent 4e36dd7 commit 0759cec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/test/libregrtest/logger.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def log(self, line: str = '') -> None:
4343

4444
def get_load_avg(self) -> float | None:
4545
if hasattr(os, 'getloadavg'):
46-
return os.getloadavg()[0]
46+
try:
47+
return os.getloadavg()[0]
48+
except OSError:
49+
pass
4750
if self.win_load_tracker is not None:
4851
return self.win_load_tracker.getloadavg()
4952
return None
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:func:`os.getloadavg` may throw :exc:`OSError` when running regression tests
2+
under certain conditions (e.g. chroot). This error is now caught and
3+
ignored, since reporting load average is optional.

0 commit comments

Comments
 (0)