Skip to content

[Question] silence warning occuring during tests #231

Open
@davidhuser

Description

@davidhuser

Describe the bug

When testing some warnings are emitted

To Reproduce

poetry run pytest
========================================================================================================================== warnings summary ==========================================================================================================================
tests/test_provider_config.py::test_http_error_old_config_found[asyncio]
  /Users/wdhuser/Library/Caches/pypoetry/virtualenvs/fastapi-azure-auth-LYhe6yHr-py3.12/lib/python3.12/site-packages/pytest_asyncio/plugin.py:380: DeprecationWarning: There is no current event loop
    old_loop = policy.get_event_loop()

tests/test_provider_config.py: 2 warnings
tests/multi_tenant/test_multi_tenant.py: 32 warnings
tests/multi_tenant_b2c/test_multi_tenant.py: 30 warnings
tests/single_tenant/test_single_tenant.py: 32 warnings
  /Users/wdhuser/Library/Caches/pypoetry/virtualenvs/fastapi-azure-auth-LYhe6yHr-py3.12/lib/python3.12/site-packages/httpx/_client.py:1437: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=ASGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================================= 177 passed, 97 warnings in 10.10s ==================================================================================================================
$ poetry run pip freeze

aiohappyeyeballs==2.4.3
aiohttp==3.10.10
aiosignal==1.3.1
annotated-types==0.7.0
anyio==3.7.1
appnope==0.1.4
asgi-lifespan==2.1.0
asgiref==3.8.1
asttokens==2.4.1
async-timeout==4.0.2
attrs==24.2.0
backcall==0.2.0
black==22.12.0
certifi==2024.8.30
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.0
click==8.1.7
coverage==7.6.1
cryptography==43.0.1
decopatch==1.4.10
decorator==5.1.1
distlib==0.3.9
ecdsa==0.18.0
executing==2.1.0
fastapi==0.115.2
-e git+ssh://[email protected]/davidhuser/fastapi-azure-auth.git@c2657ec4f6df4e11c98f4a73e65edafd22f65d95#egg=fastapi_azure_auth
filelock==3.16.1
freezegun==1.5.1
frozenlist==1.4.1
h11==0.14.0
httpcore==1.0.6
httpx==0.27.2
identify==2.6.1
idna==3.10
iniconfig==2.0.0
ipython==8.12.3
jedi==0.19.1
jsonschema==4.23.0
jsonschema-spec==0.2.4
jsonschema-specifications==2023.7.1
lazy-object-proxy==1.10.0
makefun==1.15.1
matplotlib-inline==0.1.7
multidict==6.1.0
mypy-extensions==1.0.0
nodeenv==1.9.1
openapi-schema-validator==0.6.2
openapi-spec-validator==0.6.0
outcome==1.3.0.post0
packaging==24.1
parso==0.8.4
pathable==0.4.3
pathspec==0.12.1
pexpect==4.9.0
pickleshare==0.7.5
platformdirs==4.3.6
pluggy==1.5.0
pre-commit==2.21.0
prompt_toolkit==3.0.48
propcache==0.2.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.5.0
pycparser==2.22
pydantic==2.9.2
pydantic-settings==2.5.2
pydantic_core==2.23.4
Pygments==2.18.0
PyJWT==2.9.0
pytest==7.4.4
pytest-aiohttp==1.0.5
pytest-asyncio==0.18.3
pytest-cov==3.0.0
pytest-dotenv==0.5.2
pytest-mock==3.14.0
pytest-socket==0.4.1
pytest_freezer==0.4.8
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
PyYAML==6.0.2
referencing==0.30.2
requests==2.32.3
requests-mock==1.12.1
respx==0.20.2
rfc3339-validator==0.1.4
rpds-py==0.20.0
rsa==4.9
setuptools==68.0.0
six==1.16.0
sniffio==1.3.1
sortedcontainers==2.4.0
stack-data==0.6.3
starlette==0.40.0
traitlets==5.14.3
trio==0.22.2
typing_extensions==4.12.2
urllib3==2.2.3
uvicorn==0.17.6
virtualenv==20.26.6
wcwidth==0.2.13
yarl==1.15.2

Possible solutions:

issue 1: tbd (?)

issue 2: the httpx test client should be adapted in all tests that use httpx: https://www.starlette.io/testclient/#asynchronous-tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions