Skip to content

Commit 69daf4c

Browse files
committed
Treat pytest warnings as errors
Warnings are usually a sign of something that can be improved or even wrong, like tasks not being properly awaited or cancelled, so it's a good idea to treat them as errors to avoid them getting unnoticed. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent e11697e commit 69daf4c

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515

1616
### Cookiecutter template
1717

18-
All upgrading should be done via the migration script or regenerating the templates.
18+
All upgrading should be done via the migration script or regenerating the templates. But you might still need to adapt your code:
19+
20+
- `pytest` now uses `-Werror` by default, so if your tests run with warnings, they will now be turned to errors and you'll need to fix them.
1921

2022
## New Features
2123

2224
<!-- Here goes the main new features and examples or instructions on how to use them -->
2325

2426
### Cookiecutter template
2527

26-
<!-- Here new features for cookiecutter specifically -->
28+
- `pytest` now uses `-Werror` by default.
2729

2830
## Bug Fixes
2931

cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ disable = [
203203

204204
[tool.pytest.ini_options]
205205
{%- if cookiecutter.type != "api" %}
206-
addopts = "-W=all -vv"
206+
addopts = "-W=all -Werror -vv"
207207
testpaths = ["tests", "src"]
208208
asyncio_mode = "auto"
209209
asyncio_default_fixture_loop_scope = "function"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ module = [
205205
ignore_missing_imports = true
206206

207207
[tool.pytest.ini_options]
208-
addopts = "-W=all -vv"
208+
addopts = "-W=all -Werror -vv"
209209
testpaths = ["src", "tests"]
210210
markers = [
211211
"integration: integration tests (deselect with '-m \"not integration\"')",

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ disable = [
153153
]
154154

155155
[tool.pytest.ini_options]
156-
addopts = "-W=all -vv"
156+
addopts = "-W=all -Werror -vv"
157157
testpaths = ["tests", "src"]
158158
asyncio_mode = "auto"
159159
asyncio_default_fixture_loop_scope = "function"

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ disable = [
152152
]
153153

154154
[tool.pytest.ini_options]
155-
addopts = "-W=all -vv"
155+
addopts = "-W=all -Werror -vv"
156156
testpaths = ["tests", "src"]
157157
asyncio_mode = "auto"
158158
asyncio_default_fixture_loop_scope = "function"

tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ disable = [
149149
]
150150

151151
[tool.pytest.ini_options]
152-
addopts = "-W=all -vv"
152+
addopts = "-W=all -Werror -vv"
153153
testpaths = ["tests", "src"]
154154
asyncio_mode = "auto"
155155
asyncio_default_fixture_loop_scope = "function"

tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ disable = [
153153
]
154154

155155
[tool.pytest.ini_options]
156-
addopts = "-W=all -vv"
156+
addopts = "-W=all -Werror -vv"
157157
testpaths = ["tests", "src"]
158158
asyncio_mode = "auto"
159159
asyncio_default_fixture_loop_scope = "function"

0 commit comments

Comments
 (0)