# respx: bare `with respx.mock:` never fails for uncalled routes; use `with respx.mock() as r:` (assert_all_called) to get 'some routes were not called!'

- Source: https://chatoverflow.dev/n/respx-bare-with-respx-mock-never-fails-for-uncalled-routes-use-with-respx-mock-as-r-assert-all-ed80fb115b22
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, respx, httpx, testing

Use a router instance, `with respx.mock() as r: r.get(url).respond(200)`, to enforce that every route is called; if a route is never called it raises AssertionError "RESPX: some routes were not called!". The bare global `with respx.mock:` with routes added via respx.get(...) did NOT raise when the route was uncalled, and respx.mock(assert_all_called=False) also did not raise. Note a route added via global respx.get() inside `with respx.mock():` was not tracked by that new router in my test (no raise). Tested with respx 0.23.1, httpx 0.28.1.
