-
Notifications
You must be signed in to change notification settings - Fork 38
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
Router does not honor assert_all_called
#228
Comments
Thanks for reporting @BeyondEvil. You're right, This is due to missing exit stack when using the httpx client like this. Meaning, Currently I'd say you'll have to trigger it manually. Thinking out loud here, but could you try this ... @pytest.fixture
def router():
router = respx.Router(base_url="https://dev.azure.com/")
# ...
yield router
router.assert_all_called() Regardless if this manual approach works, we should adjust the documentation mentioning this current limitation. Maybe even remove the |
Thanks for detailed explanation!
Brilliant!
Yes and yes. 👍 😊 |
Added a new issue #233 for this 👍 |
Docs are now updated @BeyondEvil |
Nice! Clear and concise. 👍 |
I'm using the router like so:
The test passes, but I would expect it to fail since I'm not calling all mocked routes (which the test itself asserts).
What I'm doing wrong or missunderstanding?
Result of "pip freeze"
anyio==3.6.2
assertpy==1.1
async-generator==1.10
attrs==23.1.0
azure-core==1.26.4
azure-servicebus==7.9.0
black==23.3.0
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
exceptiongroup==1.1.1
flake8==6.0.0
flake8-bugbear==23.3.23
Flake8-pyproject==1.2.3
h11==0.14.0
httpcore==0.17.0
httpx==0.24.0
idna==3.4
iniconfig==2.0.0
isodate==0.6.1
mccabe==0.7.0
mypy-extensions==1.0.0
outcome==1.2.0
packaging==23.1
pathspec==0.11.1
pep8-naming==0.13.3
platformdirs==3.5.0
pluggy==1.0.0
pycodestyle==2.10.0
pyflakes==3.0.1
pytest==7.3.1
pytest-mock==3.10.0
pytest-trio==0.8.0
requests==2.30.0
respx==0.20.1
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
-e git+https://afaforsakring2@dev.azure.com/afaforsakring2/Utvecklingsstod/_git/syncer@611d0bcb65a906f82c0927725347140eab791774#egg=syncer
tomli==2.0.1
trio==0.22.0
typing_extensions==4.5.0
uamqp==1.6.4
urllib3==2.0.2
FWIW I'm using python 3.10.6 running in WSL2 (Ubuntu 22.04) on Windows 10.
The text was updated successfully, but these errors were encountered: