From c20509934d4502220a8324d498835f42255cfaaf Mon Sep 17 00:00:00 2001 From: behnazh-w Date: Fri, 14 Jul 2023 06:41:49 +1000 Subject: [PATCH] test: fail on unraisable exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://docs.pytest.org/en/latest/how-to/failures.html#warning-about-unraisable-exceptions-and-unhandled-thread-exceptions unraisable exceptions and unhandled thread exceptions are normally considered bugs, but may go unnoticed because they don’t cause the program itself to crash. Pytest detects these conditions and issues a warning that is visible in the test run summary. This PR changes the warnings to errors instead. Signed-off-by: behnazh-w --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b7fd051be..d26c7f2b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -235,3 +235,8 @@ testpaths = [ env = [ "PYTHONWARNINGS=always::DeprecationWarning", ] +filterwarnings = [ + # https://docs.pytest.org/en/latest/how-to/failures.html#warning-about-unraisable-exceptions-and-unhandled-thread-exceptions + "error::pytest.PytestUnraisableExceptionWarning", + "error::pytest.PytestUnhandledThreadExceptionWarning", +]