StatusError
exceptions are impossible to debug via stack trace and message in tests
#49
Labels
tests
Unit and integration testing
When a test fails with
pytest_httpserver
due to no handler being found, it's impossible to debug the error in the test output and/or stack trace, because they don't include information about why thepytest_httpserver
handler failed to match the request.Example:
And the stack trace just shows
harborapi.exceptions.check_response_status
callinghttpx.Response.raise_for_status()
.Custom fixture to debug this?
We could add a custom fixture that eavesdrops on
StatusError
s and finds the reason it failed:There are two challenges with this: we need to go through the stack and attempt to find the
pytest_httpserver.httpserver
instance. Once we find thehttpserver
, we might not even have a handler to check if we usedexpect_oneshot_request
, as the handler is removed after receiving a request on that URL path (seemingly even if it fails to match in other respects than URL path).The text was updated successfully, but these errors were encountered: