Skip to content

testing: Explicitly pass -Werror to tests needing it #13481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Jun 3, 2025

Explicitly pass -Werror to runpytester() in the few additional tests needing it, in order to fix test failures when the test suite is run with -Wdefault or a similar override.

Fixes #13480


  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.

If this change fixes an issue, please:

  • Add text like closes #XYZW to the PR description and/or commits (where XYZW is the issue number). See the github docs for more information.

Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:

  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.

    Write sentences in the past or present tense, examples:

    • Improved verbose diff output with sequences.
    • Terminal summary statistics now use multiple colors.

    Also make sure to end the sentence with a ..

  • Add yourself to AUTHORS in alphabetical order.

Explicitly pass `-Werror` to `runpytester()` in the few additional
tests needing it, in order to fix test failures when the test suite
is run with `-Wdefault` or a similar override.

Fixes pytest-dev#13480
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 3, 2025
@@ -211,7 +211,7 @@ def test_it(request):
"""
)

result = pytester.runpytest()
result = pytester.runpytest("-Werror")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graingert Does this look good to you?

@@ -257,7 +257,7 @@ def test_it():
)

with _disable_gc():
result = pytester.runpytest()
result = pytester.runpytest("-Werror")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graingert Does this look good to you?

@@ -169,7 +169,7 @@ def test_my_warning(self):
assert True
"""
)
result = pytester.runpytest()
result = pytester.runpytest("-Werror")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm seems this one somewhat negates the purpose of the test, which IIUC is meant to pass no matter what. We should check this one... (Will try to do it later)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #13485 about this. Can you please add a @pytest.mark.skip("issue #13485") on this test for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done. For the record, I wouldn't mind leaving the test as-is either — we can just deselect it locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pytest's test suite fails if run with -Wdefault
2 participants