8000 gh-99242 Ignore error when running regression tests under certain con… · miss-islington/cpython@ebfe066 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit ebfe066

Browse files
basbloemsaatkgdiem
authored andcommitted
pythongh-99242 Ignore error when running regression tests under certain conditions. (pythonGH-121663)
(cherry picked from commit 0759cec) Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com> Co-Authored-By: Kevin Diem <kg.diem@gmail.com>
1 parent cd74ed0 commit ebfe066

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)
0