Skip to content

Commit

Permalink
More test
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Vannson committed Aug 14, 2024
1 parent 3a5d527 commit d51a92f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/inputs/deprecated/deprecated.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ message Message {
message Empty {}

service TestService {
rpc func(Empty) returns (Empty);
rpc deprecated_func(Empty) returns (Empty) { option deprecated = true; };
}
8 changes: 6 additions & 2 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ def test_message_with_deprecated_field_not_set_default(message):

@pytest.mark.asyncio
async def test_service_with_deprecated_method():

stub = TestServiceStub(MockChannel([Empty()]))
stub = TestServiceStub(MockChannel([Empty(), Empty()]))

with pytest.warns(DeprecationWarning) as record:
await stub.deprecated_func(Empty())

assert len(record) == 1
assert str(record[0].message) == f"TestService.deprecated_func is deprecated"

with pytest.warns(None) as record:
await stub.func(Empty())

assert not record

0 comments on commit d51a92f

Please sign in to comment.