Repository navigation
Closed
Labels
easystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Description
when i run chroot compile /home/abuild/rpmbuild/BUILD/Python-3.9.9/build/debug/python -m test.regrtest test_mailbox -wW
output:
Traceback (most recent call last):
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/regrtest.py", line 47, in <module>
_main()
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/regrtest.py", line 43, in _main
main()
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 733, in main
Regrtest().main(tests=tests, **kwargs)
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 655, in main
self._main(tests, kwargs)
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 708, in _main
self.run_tests()
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 535, in run_tests
self.run_tests_sequential()
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 417, in run_tests_sequential
self.log(msg)
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 145, in log
load_avg = self.getloadavg()
File "/home/abuild/rpmbuild/BUILD/Python-3.9.9/Lib/test/libregrtest/main.py", line 668, in getloadavg
return os.getloadavg()[0]
OSError: Load averages are unobtainableos:openeuler22.03
Linked PRs
- gh-99242 Catch OSError when calling getloadavg in libregrtest #106705
- gh-99242 Ignore error when running regression tests under certain conditions. #121663
- [3.13] gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663) #121669
- [3.12] gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663) #121670
Metadata
Metadata
Assignees
Labels
easystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Activity
ronaldoussoren commentedon Nov 8, 2022
You appear to be running the tests in a chroot environment? Is the proc filesystem mounted in that environment?
os.getloadavg() is a thin wrapper around getloadavg(3), which with glibc on linux loads information from a file in /proc.
ronaldoussoren commentedon Nov 17, 2022
@alittlesir, could you please answer my question?
Given the implementation of os.getloadavg() I'm pretty sure this is not a bug in CPython, but in the setup of the environment where you run the tests (e.g. not having /proc mounted there).
zware commentedon Nov 17, 2022
Agreed, there's no real bug here. However, we could just swallow the
OSErrorand return None atcpython/Lib/test/libregrtest/main.py
Lines 722 to 723 in 8555dee
zhuofeng6 commentedon Nov 18, 2022
yes, you are right, it is not a bug in CPython, because it is only happened in the chroot environment, i am sorry to waste your time
ronaldoussoren commentedon Nov 24, 2022
Agreed, the function is optional and we might as well ignore errors when calling it. Reporting the load average during test runs is not the most important part of running those tests.
[-]Load averages are unobtainable[/-][+]Ignore Load averages are unobtainable[/+][-]Ignore Load averages are unobtainable[/-][+]Ignore load averages if getloadavg is unavailable[/+]erlend-aasland commentedon Jun 27, 2023
I rebranded this as an enhancement.
pythonGH-99242 Catch OSError when calling getloadavg
gh-99242 Ignore error when running regression tests under certain con…
pythongh-99242 Ignore error when running regression tests under certa…
pythongh-99242 Ignore error when running regression tests under certa…
[3.12] gh-99242 Ignore error when running regression tests under cert…
pythongh-99242 Ignore error when running regression tests under certa…
[3.13] gh-99242 Ignore error when running regression tests under cert…
encukou commentedon Jul 22, 2024
It's a enhancement of the tests :)
Merged and backported. Thank you for the fix!