diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e728bffb..c1e64630 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,12 +10,14 @@ ```toml [tool.pytest.ini_options] - addopts = "-W=all -vv" + addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv" ``` ### Cookiecutter template -All upgrading should be done via the migration script or regenerating the templates. +All upgrading should be done via the migration script or regenerating the templates. But you might still need to adapt your code: + +- `pytest` now uses `-Werror` by default (but still treat deprecations as normal warnings), so if your tests run with warnings, they will now be turned to errors, and you'll need to fix them. ## New Features @@ -23,7 +25,7 @@ All upgrading should be done via the migration script or regenerating the templa ### Cookiecutter template - +- `pytest` now uses `-Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning` by default. Deprecations are still treated as warnings, as when testing with the `pytest_min` session is normal to get deprecation warnings as we are using old versions of dependencies. ## Bug Fixes diff --git a/cookiecutter/migrate.py b/cookiecutter/migrate.py index dfb9e4b4..7e57f4b8 100644 --- a/cookiecutter/migrate.py +++ b/cookiecutter/migrate.py @@ -40,7 +40,7 @@ def add_default_pytest_options() -> None: pyproject_toml = Path("pyproject.toml") pyproject_toml_content = pyproject_toml.read_text(encoding="utf-8") marker = "[tool.pytest.ini_options]\n" - new_options = "-W=all -vv" + new_options = "-W=all Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv" print(f"Adding default pytest options to {pyproject_toml}...") if pyproject_toml_content.find(marker) == -1: diff --git a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml index 40bf6964..ef45b2ec 100644 --- a/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml +++ b/cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml @@ -203,7 +203,7 @@ disable = [ [tool.pytest.ini_options] {%- if cookiecutter.type != "api" %} -addopts = "-W=all -vv" +addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv" testpaths = ["tests", "src"] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" diff --git a/pyproject.toml b/pyproject.toml index e7b7cc49..e923f004 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -205,7 +205,7 @@ module = [ ignore_missing_imports = true [tool.pytest.ini_options] -addopts = "-W=all -vv" +addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv" testpaths = ["src", "tests"] markers = [ "integration: integration tests (deselect with '-m \"not integration\"')", diff --git a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml index 860c1956..a8985a80 100644 --- a/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml @@ -153,7 +153,7 @@ disable = [ ] [tool.pytest.ini_options] -addopts = "-W=all -vv" +addopts = "-W=all -Werror -vv" testpaths = ["tests", "src"] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" diff --git a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml index aa080686..0ee9a7cb 100644 --- a/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml @@ -152,7 +152,7 @@ disable = [ ] [tool.pytest.ini_options] -addopts = "-W=all -vv" +addopts = "-W=all -Werror -vv" testpaths = ["tests", "src"] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" diff --git a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml index 723a3b6c..4c2134f3 100644 --- a/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml @@ -149,7 +149,7 @@ disable = [ ] [tool.pytest.ini_options] -addopts = "-W=all -vv" +addopts = "-W=all -Werror -vv" testpaths = ["tests", "src"] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" diff --git a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml index 3e662c9d..a1fcc2bf 100644 --- a/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml +++ b/tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml @@ -153,7 +153,7 @@ disable = [ ] [tool.pytest.ini_options] -addopts = "-W=all -vv" +addopts = "-W=all -Werror -vv" testpaths = ["tests", "src"] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function"