diff --git a/pyproject.toml b/pyproject.toml index f18196be..f4356c84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,6 +124,11 @@ addopts = """ --cov-report=xml """ asyncio_mode = "auto" +filterwarnings = [ + "error", + # falcon.media.handlers uses cgi to parse data + "ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning", +] [tool.black] line-length = 79 diff --git a/tests/integration/contrib/aiohttp/test_aiohttp_project.py b/tests/integration/contrib/aiohttp/test_aiohttp_project.py index 9b1aee14..ea659378 100644 --- a/tests/integration/contrib/aiohttp/test_aiohttp_project.py +++ b/tests/integration/contrib/aiohttp/test_aiohttp_project.py @@ -16,10 +16,10 @@ def project_setup(): @pytest.fixture -def app(project_setup, loop): +def app(project_setup): from aiohttpproject.__main__ import get_app - return get_app(loop=loop) + return get_app() @pytest.fixture diff --git a/tests/integration/contrib/flask/data/v3.0/flaskproject/openapi.py b/tests/integration/contrib/flask/data/v3.0/flaskproject/openapi.py index 6a4daea8..ac65a703 100644 --- a/tests/integration/contrib/flask/data/v3.0/flaskproject/openapi.py +++ b/tests/integration/contrib/flask/data/v3.0/flaskproject/openapi.py @@ -3,8 +3,6 @@ import yaml from jsonschema_path import SchemaPath -from openapi_core.contrib.falcon.middlewares import FalconOpenAPIMiddleware - openapi_spec_path = Path("tests/integration/data/v3.0/petstore.yaml") spec_dict = yaml.load(openapi_spec_path.read_text(), yaml.Loader) spec = SchemaPath.from_dict(spec_dict) diff --git a/tests/integration/contrib/requests/conftest.py b/tests/integration/contrib/requests/conftest.py new file mode 100644 index 00000000..ffe8d600 --- /dev/null +++ b/tests/integration/contrib/requests/conftest.py @@ -0,0 +1,11 @@ +import unittest + +import pytest + + +@pytest.fixture(autouse=True) +def disable_builtin_socket(scope="session"): + # ResourceWarning from pytest with responses 0.24.0 workaround + # See https://github.com/getsentry/responses/issues/689 + with unittest.mock.patch("socket.socket"): + yield diff --git a/tests/integration/contrib/starlette/test_starlette_project.py b/tests/integration/contrib/starlette/test_starlette_project.py index ee7027f7..fc799a30 100644 --- a/tests/integration/contrib/starlette/test_starlette_project.py +++ b/tests/integration/contrib/starlette/test_starlette_project.py @@ -159,7 +159,7 @@ def test_post_required_header_param_missing(self, client): def test_post_media_type_invalid(self, client): client.cookies.set("user", "1") - data = "data" + content = "data" content_type = "text/html" headers = { "Authorization": "Basic testuser", @@ -168,7 +168,7 @@ def test_post_media_type_invalid(self, client): } response = client.post( "https://staging.gigantic-server.com/v1/pets", - data=data, + content=content, headers=headers, ) @@ -350,22 +350,22 @@ def test_get_valid(self, client): class TestPetPhotoEndpoint(BaseTestPetstore): def test_get_valid(self, client, data_gif): + client.cookies.set("user", "1") headers = { "Authorization": "Basic testuser", "Api-Key": self.api_key_encoded, } - cookies = {"user": "1"} response = client.get( "/v1/pets/1/photo", headers=headers, - cookies=cookies, ) assert response.content == data_gif assert response.status_code == 200 def test_post_valid(self, client, data_gif): + client.cookies.set("user", "1") content_type = "image/gif" headers = { "Authorization": "Basic testuser", @@ -373,12 +373,10 @@ def test_post_valid(self, client, data_gif): "Content-Type": content_type, } - cookies = {"user": "1"} response = client.post( "/v1/pets/1/photo", headers=headers, - data=data_gif, - cookies=cookies, + content=data_gif, ) assert not response.text diff --git a/tests/unit/test_paths_spec.py b/tests/unit/test_paths_spec.py index e6e89183..f93dae47 100644 --- a/tests/unit/test_paths_spec.py +++ b/tests/unit/test_paths_spec.py @@ -22,4 +22,5 @@ def test_validator_none(self): def test_spec_validator_cls_none(self): schema = {} - Spec.from_dict(schema, spec_validator_cls=None) + with pytest.warns(DeprecationWarning): + Spec.from_dict(schema, spec_validator_cls=None)