You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a RequestsMock() is used as a context manager, assert_all_requests_are_fired is defaulted to True and an exception is raised at the end of the context block if a response is unused. However, using the @responses.activate decorator on a test function defaults assert_all_requests_are_fired to False leading to inconsistent behaviour.
Additional context
As a workaround, I have tried setting responses.mock.assert_all_requests_are_fired = True in conftest.py or just after an import of requests. However, this does not change the behaviour. The issue appears to be that the value in the default mock is never used as it gets defaulted by a default parameter in activate(), see: code.
Describe the bug
When a
RequestsMock()
is used as a context manager,assert_all_requests_are_fired
is defaulted to True and an exception is raised at the end of the context block if a response is unused. However, using the@responses.activate
decorator on a test function defaultsassert_all_requests_are_fired
to False leading to inconsistent behaviour.Additional context
As a workaround, I have tried setting
responses.mock.assert_all_requests_are_fired = True
in conftest.py or just after an import of requests. However, this does not change the behaviour. The issue appears to be that the value in the default mock is never used as it gets defaulted by a default parameter inactivate()
, see: code.Version of
responses
0.25.3
Steps to Reproduce
Expected Result
Both test cases to fail with:
Actual Result
First test case fails.
Second test case passes.
The text was updated successfully, but these errors were encountered: