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
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
3 changes: 3 additions & 0 deletions changelog/13480.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Modified a few self-tests to explicitly pass ``-Werror``
to ``runpytester()``, in order to fix test failures when the test suite
is run with ``-Wdefault`` or a similar override.
2 changes: 1 addition & 1 deletion testing/test_threadexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?


# TODO: should be a test failure or error
assert result.ret == pytest.ExitCode.INTERNAL_ERROR
Expand Down
2 changes: 1 addition & 1 deletion testing/test_unraisableexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?


# TODO: should be a test failure or error
assert result.ret == pytest.ExitCode.INTERNAL_ERROR
Expand Down
1 change: 1 addition & 0 deletions testing/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def test_func(fix):
)


@pytest.mark.skip("issue #13485")
def test_works_with_filterwarnings(pytester: Pytester) -> None:
"""Ensure our warnings capture does not mess with pre-installed filters (#2430)."""
pytester.makepyfile(
Expand Down