-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support for httpx > 0.17.x #40
Comments
Thanks for reporting.
|
Trying to run the tests for PyRMVtransport with
|
Yes, as stated in changelog you have to rename So your test case should be modified: @pytest.mark.asyncio
@pytest.mark.xfail(raises=RMVtransportError)
async def test__query_rmv_api_fail(httpx_mock):
"""Test failing station search."""
def raise_timeout(request, extensions: dict):
raise httpx.ReadTimeout(
f"Unable to read within {extensions['timeout']}", request=request
)
httpx_mock.add_callback(raise_timeout)
with pytest.raises(httpx.ReadTimeout):
rmv = RMVtransport(timeout=0.005)
url = f"https://{URL}{URL_SEARCH_PATH}"
await rmv._query_rmv_api(url) Note that what you are mocking is actually the exact behavior of the mock by default, you should be able to modify your test this way and have the same behavior: @pytest.mark.asyncio
@pytest.mark.xfail(raises=RMVtransportError)
async def test__query_rmv_api_fail(httpx_mock):
"""Test failing station search."""
with pytest.raises(httpx.ReadTimeout):
rmv = RMVtransport(timeout=0.005)
url = f"https://{URL}{URL_SEARCH_PATH}"
await rmv._query_rmv_api(url) Best Regards |
httpx
released a new version. Currently thehttpx
is limited to0.17.*
.It would be nice if
pytest-httpx
is updated.Thanks
The text was updated successfully, but these errors were encountered: