Skip to content

Update no-warning tests for pytest-8 #622

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

Merged
merged 1 commit into from
Oct 5, 2024
Merged
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: 6 additions & 9 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ def test_message_with_deprecated_field(message):


def test_message_with_deprecated_field_not_set(message):
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
Test(value=10)

assert not record


def test_message_with_deprecated_field_not_set_default(message):
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
_ = Test(value=10).message

assert not record


@pytest.mark.asyncio
async def test_service_with_deprecated_method():
Expand All @@ -58,7 +56,6 @@ async def test_service_with_deprecated_method():
assert len(record) == 1
assert str(record[0].message) == f"TestService.deprecated_func is deprecated"

with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
await stub.func(Empty())

assert not record
Loading