Skip to content

Commit 9cf4dc2

Browse files
authored
Merge pull request #790 from mgorny/pytest-8
Remove spurious `pytest.warns()` to fix pytest-8 compatibility
2 parents 46d94e9 + 36da765 commit 9cf4dc2

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

tests/unit/test_shortcuts.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ def test_request_response_error(self, mock_unmarshal, spec_v31):
423423
mock_unmarshal.return_value = ResultMock(error_to_raise=ValueError)
424424

425425
with pytest.raises(ValueError):
426-
with pytest.warns(DeprecationWarning):
427-
unmarshal_response(request, response, spec=spec_v31)
426+
unmarshal_response(request, response, spec=spec_v31)
428427

429428
mock_unmarshal.assert_called_once_with(request, response)
430429

@@ -597,15 +596,13 @@ def test_spec_invalid(self, spec_invalid):
597596
request = mock.Mock(spec=Request)
598597

599598
with pytest.raises(SpecError):
600-
with pytest.warns(DeprecationWarning):
601-
validate_request(request, spec=spec_invalid)
599+
validate_request(request, spec=spec_invalid)
602600

603601
def test_spec_not_detected(self, spec_v20):
604602
request = mock.Mock(spec=Request)
605603

606604
with pytest.raises(SpecError):
607-
with pytest.warns(DeprecationWarning):
608-
validate_request(request, spec=spec_v20)
605+
validate_request(request, spec=spec_v20)
609606

610607
def test_request_type_invalid(self, spec_v31):
611608
request = mock.sentinel.request
@@ -733,8 +730,7 @@ def test_webhook_request_validator_not_found(self, spec_v30):
733730
request = mock.Mock(spec=WebhookRequest)
734731

735732
with pytest.raises(SpecError):
736-
with pytest.warns(DeprecationWarning):
737-
validate_request(request, spec=spec_v30)
733+
validate_request(request, spec=spec_v30)
738734

739735
@mock.patch(
740736
"openapi_core.validation.request.validators.V31WebhookRequestValidator."
@@ -889,16 +885,14 @@ def test_spec_not_detected(self, spec_invalid):
889885
response = mock.Mock(spec=Response)
890886

891887
with pytest.raises(SpecError):
892-
with pytest.warns(DeprecationWarning):
893-
validate_response(request, response, spec=spec_invalid)
888+
validate_response(request, response, spec=spec_invalid)
894889

895890
def test_spec_not_supported(self, spec_v20):
896891
request = mock.Mock(spec=Request)
897892
response = mock.Mock(spec=Response)
898893

899894
with pytest.raises(SpecError):
900-
with pytest.warns(DeprecationWarning):
901-
validate_response(request, response, spec=spec_v20)
895+
validate_response(request, response, spec=spec_v20)
902896

903897
def test_request_type_invalid(self, spec_v31):
904898
request = mock.sentinel.request
@@ -965,8 +959,7 @@ def test_webhook_response_validator_not_found(self, spec_v30):
965959
response = mock.Mock(spec=Response)
966960

967961
with pytest.raises(SpecError):
968-
with pytest.warns(DeprecationWarning):
969-
validate_response(request, response, spec=spec_v30)
962+
validate_response(request, response, spec=spec_v30)
970963

971964
@mock.patch(
972965
"openapi_core.validation.response.validators.V31WebhookResponseValidator."

0 commit comments

Comments
 (0)