Skip to content

Commit 9c4eb5e

Browse files
tests: Trigger Pytest failure when an unraisable exception occurs (#4738)
Set Pytest command-line argument to return non-zero exit code when an unraisable exception is encountered. Closes #4723.
1 parent b1a8b63 commit 9c4eb5e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scripts/populate_tox/tox.jinja

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ commands =
429429
; Running `pytest` as an executable suffers from an import error
430430
; when loading tests in scenarios. In particular, django fails to
431431
; load the settings from the test module.
432-
python -m pytest {env:TESTPATH} -o junit_suite_name={envname} {posargs}
432+
python -m pytest -W error::pytest.PytestUnraisableExceptionWarning {env:TESTPATH} -o junit_suite_name={envname} {posargs}
433433
434434
[testenv:linters]
435435
commands =

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# The file (and all resulting CI YAMLs) then need to be regenerated via
1111
# "scripts/generate-test-files.sh".
1212
#
13-
# Last generated: 2025-09-02T10:59:55.249513+00:00
13+
# Last generated: 2025-09-02T12:34:09.591543+00:00
1414

1515
[tox]
1616
requires =
@@ -909,7 +909,7 @@ commands =
909909
; Running `pytest` as an executable suffers from an import error
910910
; when loading tests in scenarios. In particular, django fails to
911911
; load the settings from the test module.
912-
python -m pytest {env:TESTPATH} -o junit_suite_name={envname} {posargs}
912+
python -m pytest -W error::pytest.PytestUnraisableExceptionWarning {env:TESTPATH} -o junit_suite_name={envname} {posargs}
913913

914914
[testenv:linters]
915915
commands =

0 commit comments

Comments
 (0)