https://github.com/python/cpython/commit/f00ba7335a1f4954197ea4eb7bcda861220e20eb
commit: f00ba7335a1f4954197ea4eb7bcda861220e20eb
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2024-07-22T14:53:46+02:00
summary:

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

(cherry picked from commit 0759cecd9d945dfbac2226febaba51f41195555c)

Co-authored-by: Bas Bloemsaat <[email protected]>
Co-authored-by: Kevin Diem <[email protected]>

files:
A Misc/NEWS.d/next/Tests/2024-07-13-11-04-44.gh-issue-99242.aGxnwz.rst
M Lib/test/libregrtest/logger.py

diff --git a/Lib/test/libregrtest/logger.py b/Lib/test/libregrtest/logger.py
index a125706927393c..fa1d4d575c8fd4 100644
--- a/Lib/test/libregrtest/logger.py
+++ b/Lib/test/libregrtest/logger.py
@@ -43,7 +43,10 @@ def log(self, line: str = '') -> None:
 
     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
diff --git 
a/Misc/NEWS.d/next/Tests/2024-07-13-11-04-44.gh-issue-99242.aGxnwz.rst 
b/Misc/NEWS.d/next/Tests/2024-07-13-11-04-44.gh-issue-99242.aGxnwz.rst
new file mode 100644
index 00000000000000..7d904f26a36ff2
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2024-07-13-11-04-44.gh-issue-99242.aGxnwz.rst
@@ -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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to