Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/release-notes/artifacts/werror-unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# --- Release notes artifact ----

schema_version: 1
changes:
- title: Run the unit tests with warnings promoted to errors
author: tonyandrewmeyer
type: chore
description: |
The unit tests now run with `filterwarnings = ["error", ...]`, so a deprecation or resource leak fails the suite instead of scrolling past in the log. Three third-party warnings are ignored by message; the charm's own code raises none. Integration tests are unaffected.
urls:
pr: https://github.com/canonical/indico-operator/pull/776
related_doc:
related_issue:
visibility: internal
highlight: false
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ pythonpath = [
"lib",
"src",
]
# Turn warnings into errors so deprecations and resource leaks fail the unit
# suite rather than accumulating unnoticed. Each ignore below is anchored to a
# specific message and is for third-party code; the charm's own code raises
# none. The integration env opts out (see tox.ini) because the warnings there
# come from juju/websockets and are not ours to fix.
filterwarnings = [
"error",
# Raised by the vendored loki_k8s charm lib and by paas_charm; the fixes
# belong upstream in canonical/loki-k8s-operator and canonical/paas-charm.
"ignore:JujuVersion.from_environ\\(\\) is deprecated:DeprecationWarning",
# paas_charm.charm_state calls pydantic's deprecated BaseModel.dict();
# the fix belongs upstream in canonical/paas-charm.
"ignore:The `dict` method is deprecated; use `model_dump` instead:DeprecationWarning",
]

# Linting tools configuration
[tool.ruff]
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ commands =
-s \
--tb native \
--log-cli-level=INFO \
--override-ini=filterwarnings= \
{posargs} \
{[vars]tests_path}/integration
Loading