Skip to content

Deprecation warnings fix #720

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
Nov 8, 2023
Merged
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
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/contrib/aiohttp/test_aiohttp_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 11 additions & 0 deletions tests/integration/contrib/requests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
12 changes: 5 additions & 7 deletions tests/integration/contrib/starlette/test_starlette_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
)

Expand Down Expand Up @@ -350,35 +350,33 @@ 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",
"Api-Key": self.api_key_encoded,
"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
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_paths_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)