pywbemtools
pywbemtools copied to clipboard
Unit test: listener test_start_cmd.py fails with additional lines
Listener test_start_cmd.py fails with additional lines.
Examples:
- master: https://github.com/pywbem/pywbemtools/actions/runs/18121530575/job/51567434113
- 1.3: https://github.com/pywbem/pywbemtools/actions/runs/18121479056/job/51567428690
Example for the additional lines:
E Exception ignored in: <module 'threading' from '/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py'>
E Traceback (most recent call last):
E File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1624, in _shutdown
E lock.acquire()
E File "/Users/maiera/Projects/pywbem/pywbemtools/pywbemtools/pywbemlistener/_cmd_listener.py", line 916, in run_term_signal_handler
E raise SystemExit(1)
E SystemExit: 1
It turns out that the additional lines are a pytest warning about unraisable exceptions. In this case, it warns that the signal handler raises SystemExit.
See:
- https://docs.pytest.org/en/stable/how-to/failures.html#warning-about-unraisable-exceptions-and-unhandled-thread-exceptions
- https://docs.pytest.org/en/stable/reference/reference.html#pytest.PytestUnraisableExceptionWarning
- https://medium.com/@BartekSkwira/how-to-solve-pytest-pytestunraisableexceptionwarning-8d75a4d1f801
The first link states that these warnings can be silenced selectively, but that did not work with either of them.
A mitigation for now is to tolerate the pytest warning in our checking of stderr. That is what the PR does.