classification
Title: libregrtest: mark a test as failed if a thread logs an unexpected exception
Type: Stage: resolved
Components: Tests Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2021-04-14 11:20 by vstinner, last changed 2021-05-26 22:17 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25400 merged vstinner, 2021-04-14 11:30
Messages (4)
msg391059 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-14 11:20
The Python test runner (libregrtest) should mark a test as failed if a thread logs an unexpected exception, as already done with unraisable exception.

See for example bpo-43842 where test_logging logs the following exception, but the tes is marked as passed:

Exception in thread Thread-25 (serve_forever):
Traceback (most recent call last):
  File "/usr/home/vstinner/python/master/Lib/threading.py", line 990, in _bootstrap_inner
    self.run()
  File "/usr/home/vstinner/python/master/Lib/threading.py", line 928, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/vstinner/python/master/Lib/test/test_logging.py", line 863, in serve_forever
    asyncore.loop(poll_interval, map=self._map)
  File "/usr/home/vstinner/python/master/Lib/asyncore.py", line 203, in loop
    poll_fun(timeout, map)
  File "/usr/home/vstinner/python/master/Lib/asyncore.py", line 144, in poll
    r, w, e = select.select(r, w, e, timeout)
OSError: [Errno 9] Bad file descriptor


Attached PR implements this change.
msg391188 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-16 12:33
New changeset b136b1aac4b7d07e3120ee59e41c02bc86032162 by Victor Stinner in branch 'master':
bpo-43843: libregrtest uses threading.excepthook (GH-25400)
https://github.com/python/cpython/commit/b136b1aac4b7d07e3120ee59e41c02bc86032162
msg391189 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-16 13:03
test_concurrent_futures logs two warnings.

s390x Debian 3.x:
https://buildbot.python.org/all/#/builders/49/builds/1124

AMD64 RHEL7 3.x:
https://buildbot.python.org/all/#/builders/15/builds/1074

0:03:18 load avg: 4.78 [302/427] test_concurrent_futures passed (2 min 46 sec) -- running: test_tokenize (37.8 sec), test_peg_generator (59.2 sec)
Warning -- Uncaught thread exception: SystemExit
Warning -- Uncaught thread exception: SystemExit
msg391208 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-16 14:50
test_concurrent_futures logs two warnings: I created bpo-43867 for this one.
History
Date User Action Args
2021-05-26 22:17:30vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-04-16 14:50:04vstinnersetmessages: + msg391208
2021-04-16 13:03:59vstinnersetmessages: + msg391189
2021-04-16 12:33:13vstinnersetmessages: + msg391188
2021-04-14 11:30:59vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request24132
2021-04-14 11:20:23vstinnercreate