Looks like pytest shows some warnings + call trace bout useALLOWED_HOSTS`.
Here is pytest output:
```console
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/openapi-core-0.18.1
configfile: pyproject.toml
plugins: timeout-2.2.0, anyio-4.0.0, asyncio-0.21.1, flake8-1.1.1, aiohttp-1.0.5
asyncio: mode=auto
collected 1404 items
tests/integration/test_minimal.py ............................................................
tests/integration/test_petstore.py .................x......................
tests/integration/contrib/aiohttp/test_aiohttp_project.py ..
tests/integration/contrib/aiohttp/test_aiohttp_validation.py ...s..s..
tests/integration/contrib/django/test_django_project.py Bad Request: /v1/pets
..Bad Request: /v1/pets
.Bad Request: /v1/pets
.Unsupported Media Type: /v1/pets
.Bad Request: /v1/pets
...Invalid HTTP_HOST header: 'testserver'. You may need to add 'testserver' to ALLOWED_HOSTS.
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/lib/python3.8/site-packages/django/utils/deprecation.py", line 133, in __call__
response = self.process_request(request)
File "/usr/lib/python3.8/site-packages/django/middleware/common.py", line 48, in process_request
host = request.get_host()
File "/usr/lib/python3.8/site-packages/django/http/request.py", line 150, in get_host
raise DisallowedHost(msg)
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'testserver'. You may need to add 'testserver' to ALLOWED_HOSTS.
Bad Request: /v1/pets/12
.Forbidden: /v1/pets/12
.Method Not Allowed: /v1/pets/12
...Unsupported Media Type: /v1/tags
....
tests/integration/contrib/falcon/test_falcon_project.py ..............x
tests/integration/contrib/flask/test_flask_decorator.py ..........
tests/integration/contrib/flask/test_flask_project.py ..
tests/integration/contrib/flask/test_flask_validator.py .
tests/integration/contrib/flask/test_flask_views.py .......
tests/integration/contrib/requests/test_requests_validation.py .......
tests/integration/contrib/starlette/test_starlette_project.py ..............
tests/integration/contrib/starlette/test_starlette_validation.py ..
tests/integration/contrib/werkzeug/test_werkzeug_validation.py ...
tests/integration/schema/test_empty.py .
tests/integration/schema/test_link_spec.py ....
tests/integration/schema/test_path_params.py ..
tests/integration/schema/test_spec.py ..
tests/integration/unmarshalling/test_read_only_write_only.py ....
tests/integration/unmarshalling/test_request_unmarshaller.py .............
tests/integration/unmarshalling/test_response_unmarshaller.py ..........
tests/integration/unmarshalling/test_security_override.py .....
tests/integration/unmarshalling/test_unmarshallers.py ...............xxxxxxx........................................................................................................................................................................................................................xxxxxxx......................................................................................................................................................................................................................................................................................................................................................................xx..........................
tests/integration/validation/test_request_validators.py .......
tests/integration/validation/test_response_validators.py ..........
tests/unit/test_shortcuts.py ......................................................................................................
tests/unit/test_util.py .................
tests/unit/casting/test_schema_casters.py ........
tests/unit/contrib/aiohttp/test_aiohttp_requests.py .
tests/unit/contrib/aiohttp/test_aiohttp_responses.py .
tests/unit/contrib/django/test_django.py .........
tests/unit/contrib/flask/test_flask_requests.py ....
tests/unit/contrib/flask/test_flask_responses.py ..
tests/unit/contrib/requests/test_requests_requests.py ......
tests/unit/contrib/requests/test_requests_responses.py ..
tests/unit/deserializing/test_media_types_deserializers.py ..............................
tests/unit/deserializing/test_styles_deserializers.py ..............................................................
tests/unit/extensions/test_factories.py ..
tests/unit/schema/test_schema_parameters.py .....................................................................................................................................................
tests/unit/security/test_providers.py .........
tests/unit/templating/test_media_types_finders.py .....
tests/unit/templating/test_paths_finders.py X...x...x............X...x...x...............
tests/unit/templating/test_responses_finders.py ...
tests/unit/templating/test_templating_util.py ....xx
tests/unit/unmarshalling/test_path_item_params_validator.py ......
tests/unit/unmarshalling/test_schema_unmarshallers.py ......x.
tests/unit/validation/test_schema_validators.py .................................................
===================================================================================== warnings summary ======================================================================================
tests/integration/test_petstore.py: 14 warnings
/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/openapi_core/validation/request/validators.py:194: DeprecationWarning: limit parameter is deprecated
warnings.warn(
tests/integration/test_petstore.py: 14 warnings
/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/openapi_core/validation/validators.py:181: DeprecationWarning: Use of allowEmptyValue property is deprecated
warnings.warn(
tests/integration/test_petstore.py::TestPetstore::test_get_pets_allow_empty_value
/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/openapi_core/validation/validators.py:196: DeprecationWarning: Use of allowEmptyValue property is deprecated
warnings.warn(
tests/integration/test_petstore.py::TestPetstore::test_delete_tags_with_requestbody
tests/integration/test_petstore.py::TestPetstore::test_delete_tags_with_requestbody
/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-core-0.18.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/openapi_core/validation/response/validators.py:177: DeprecationWarning: x-delete-confirm header is deprecated
warnings.warn(
tests/integration/contrib/aiohttp/test_aiohttp_project.py::TestPetPhotoView::test_get_valid
tests/integration/contrib/aiohttp/test_aiohttp_project.py::TestPetPhotoView::test_post_valid
/usr/lib/python3.8/site-packages/pytest_aiohttp/plugin.py:33: DeprecationWarning: 'loop' fixture is deprecated and scheduled for removal, please use 'event_loop' instead
warnings.warn(
tests/integration/contrib/aiohttp/test_aiohttp_project.py::TestPetPhotoView::test_get_valid
tests/integration/contrib/aiohttp/test_aiohttp_project.py::TestPetPhotoView::test_post_valid
/home/tkloczko/rpmbuild/BUILD/openapi-core-0.18.1/tests/integration/contrib/aiohttp/data/v3.0/aiohttpproject/__main__.py:10: DeprecationWarning: loop argument is deprecated
app = web.Application(loop=loop)
tests/integration/contrib/django/test_django_project.py::TestPetListView::test_get_no_required_param
/usr/lib/python3.8/site-packages/django/conf/__init__.py:267: RemovedInDjango50Warning: The USE_L10N setting is deprecated. Starting with Django 5.0, localized formatting of data will always be enabled. For example Django will display numbers and dates using the format of the current locale.
warnings.warn(USE_L10N_DEPRECATED_MSG, RemovedInDjango50Warning)
tests/integration/contrib/requests/test_requests_validation.py::TestV31RequestsFactory::test_response_validator_path_pattern
/usr/lib/python3.8/site-packages/responses/__init__.py:422: DeprecationWarning: Argument 'match_querystring' is deprecated. Use 'responses.matchers.query_param_matcher' or 'responses.matchers.query_string_matcher'
warn(
tests/integration/contrib/starlette/test_starlette_project.py::TestPetListEndpoint::test_post_media_type_invalid
tests/integration/contrib/starlette/test_starlette_project.py::TestPetPhotoEndpoint::test_post_valid
/usr/lib/python3.8/site-packages/httpx/_content.py:204: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
warnings.warn(message, DeprecationWarning)
tests/integration/contrib/starlette/test_starlette_project.py::TestPetPhotoEndpoint::test_get_valid
tests/integration/contrib/starlette/test_starlette_project.py::TestPetPhotoEndpoint::test_post_valid
/usr/lib/python3.8/site-packages/httpx/_client.py:799: DeprecationWarning: Setting per-request cookies=<...> is being deprecated, because the expected behaviour on cookie persistence is ambiguous. Set cookies directly on the client instance instead.
warnings.warn(message, DeprecationWarning)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
-------------------------------------------------- generated xml file: /home/tkloczko/rpmbuild/BUILD/openapi-core-0.18.1/reports/junit.xml --------------------------------------------------
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/integration/contrib/aiohttp/test_aiohttp_validation.py:39: No validation for given handler.
SKIPPED [1] tests/integration/contrib/aiohttp/test_aiohttp_validation.py:77: No validation for given handler.
XFAIL tests/integration/test_petstore.py::TestPetstore::test_post_urlencoded - urlencoded object with oneof not supported
XFAIL tests/integration/contrib/falcon/test_falcon_project.py::TestPetPhotoResource::test_post_valid - falcon request binary handler not implemented
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_string_format_binary_invalid - OAS 3.0 string type checker allows byte. See https://github.com/python-openapi/openapi-schema-validator/issues/64
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types0-string] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types1-2] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types2-3.14] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types3-True] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types4-value4] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30RequestSchemaUnmarshallersFactory::test_nultiple_types_undefined[types5-value5] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_string_format_binary_invalid - OAS 3.0 string type checker allows byte. See https://github.com/python-openapi/openapi-schema-validator/issues/64
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types0-string] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types1-2] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types2-3.14] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types3-True] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types4-value4] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS30ResponseSchemaUnmarshallersFactory::test_nultiple_types_undefined[types5-value5] - Rraises TypeError not SchemaError. See ttps://github.com/python-openapi/openapi-schema-validator/issues/65
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS31SchemaUnmarshallersFactory::test_create_oas30_formatter_not_found[string-byte] - OpenAPI 3.1 schema validator uses OpenAPI 3.0 format checker.See https://github.com/python-openapi/openapi-core/issues/506
XFAIL tests/integration/unmarshalling/test_unmarshallers.py::TestOAS31SchemaUnmarshallersFactory::test_create_oas30_formatter_not_found[string-binary] - OpenAPI 3.1 schema validator uses OpenAPI 3.0 format checker.See https://github.com/python-openapi/openapi-core/issues/506
XFAIL tests/unit/templating/test_paths_finders.py::TestOperationSimpleServerServerNotFound::test_raises - returns default server
XFAIL tests/unit/templating/test_paths_finders.py::TestPathSimpleServerServerNotFound::test_raises - returns default server
XFAIL tests/unit/templating/test_paths_finders.py::TestOperationVariableServerServerNotFound::test_raises - returns default server
XFAIL tests/unit/templating/test_paths_finders.py::TestPathVariableServerServerNotFound::test_raises - returns default server
XFAIL tests/unit/templating/test_templating_util.py::TestSearch::test_special_chars_valid[/{test~id}/test-expected0] - Special characters of regex not supported. See https://github.com/python-openapi/openapi-core/issues/672
XFAIL tests/unit/templating/test_templating_util.py::TestSearch::test_special_chars_valid[/{test-id}/test-expected1] - Special characters of regex not supported. See https://github.com/python-openapi/openapi-core/issues/672
XFAIL tests/unit/unmarshalling/test_schema_unmarshallers.py::TestOAS30SchemaUnmarshallerUnmarshal::test_schema_format_validator_format_invalid - Not registered format raises FormatterNotFoundErrorSee https://github.com/python-openapi/openapi-core/issues/515
XPASS tests/unit/templating/test_paths_finders.py::TestSpecSimpleServerServerNotFound::test_raises returns default server
XPASS tests/unit/templating/test_paths_finders.py::TestSpecVariableServerServerNotFound::test_raises returns default server
=========================================================== 1375 passed, 2 skipped, 25 xfailed, 2 xpassed, 41 warnings in 12.91s ============================================================
```
Expected Behavior
pytest should pass clean,
Steps to Reproduce
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
install .whl file in </install/prefix> using 'installer` module
run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Actual Behavior
Looks like pytest shows some warnings + call trace
bout use
ALLOWED_HOSTS`. Here is pytest output:Expected Behavior
pytest should pass clean,
Steps to Reproduce
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulescut off from access to the public network
(pytest is executed with-m "not network"
)OpenAPI Core Version
0.18.1 + all commits up to f5f5792a
OpenAPI Core Integration
N/A
Affected Area(s)
Module testing using pytest.
References
N/A
Anything else we need to know?
Here is list of installed modules in build env
I think that because 86f82182 (
jsonschema-spec
tojsonschema-path
migration) it would be good to release new version.Would you like to implement a fix?
None