Skip to content

Commit a49fdd3

Browse files
committed
Treat warnings as errors in tests
We need to make an exception for `PytestUnraisableExceptionWarning` because we have some cleanup issues, and sometimes exceptions are raised in `__del__` methods, for example when trying to do async stuff and the event loop is already closed. This could even be caused by the GC, some time after the test function that has the issue was completed. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent e10d5e9 commit a49fdd3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ disable = [
163163
max-attributes = 12
164164

165165
[tool.pytest.ini_options]
166+
# We need to ignore PytestUnraisableExceptionWarning because we have some
167+
# cleanup issues, and sometimes exceptions are raised in __del__ methods, for
168+
# example when trying to do async stuff and the event loop is already closed.
169+
# This could even be caused by the GC, some time after the test function that
170+
# has the issue was completed.
171+
# Please see this issue for more details:
172+
# https://github.com/frequenz-floss/frequenz-sdk-python/issues/982
173+
addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -Wdefault::pytest.PytestUnraisableExceptionWarning -vv"
166174
testpaths = ["tests", "src"]
167175
asyncio_mode = "auto"
168176
asyncio_default_fixture_loop_scope = "function"

0 commit comments

Comments
 (0)