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
Moto v1.3 causes my tests to fail if I set responses.mock.assert_all_requests_are_fired = True.
I set responses.mock.assert_all_requests_are_fired = True to make sure that my application is behaving as expected, but since it doesn't make all the requests to all the moto urls then my test fails.
How to recreate
craig@amogato2:/tmp
$ virtualenv /tmp/moto-error
New python executable in /tmp/moto-error/bin/python
Installing setuptools, pip, wheel...done.
craig@amogato2:/tmp
$ source /tmp/moto-error/bin/activate
[moto-error] craig@amogato2:/tmp
$ pip install pytest-responses moto
... output removed ...
[moto-error] craig@amogato2:/tmp
$ echo -e "import responses\nfrom moto import *\nresponses.mock.assert_all_requests_are_fired = True\n@mock_dynamodb2\ndef test_pass():\n pass" > test.py
[moto-error] craig@amogato2:/tmp
$ pytest test.py
======================================== test session starts ========================================
platform darwin -- Python 2.7.10, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /private/tmp, inifile:
plugins: responses-0.3.0
collected 1 item
test.py F
============================================= FAILURES ==============================================
_____________________________________________ test_pass _____________________________________________
args = (), kwargs = {}, result = None
def wrapper(*args, **kwargs):
self.start(reset=reset)
try:
result = func(*args, **kwargs)
finally:
> self.stop()
/tmp/moto-error/lib/python2.7/site-packages/moto/core/models.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/tmp/moto-error/lib/python2.7/site-packages/moto/core/models.py:65: in stop
self.disable_patching()
/tmp/moto-error/lib/python2.7/site-packages/moto/core/models.py:220: in disable_patching
responses_mock.stop()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <responses.RequestsMock object at 0x10c59ab90>, allow_assert = True
def stop(self, allow_assert=True):
self._patcher.stop()
if not self.assert_all_requests_are_fired:
return
if not allow_assert:
return
not_called = [m for m in self._matches if m.call_count == 0]
if not_called:
raise AssertionError(
'Not all requests have been executed {0!r}'.format([(
> match.method, match.url) for match in not_called]))
E AssertionError: Not all requests have been executed [(u'GET', <_sre.SRE_Pattern object at 0x10d53d030>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'GET', <_sre.SRE_Pattern object at 0x10de469b8>), (u'GET', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'GET', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10d53d030>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'DELETE', <_sre.SRE_Pattern object at 0x10de469b8>), (u'DELETE', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'DELETE', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10d53d030>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'HEAD', <_sre.SRE_Pattern object at 0x10de469b8>), (u'HEAD', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'HEAD', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10d53d030>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10de469b8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'OPTIONS', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10d53d030>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'PATCH', <_sre.SRE_Pattern object at 0x10de469b8>), (u'PATCH', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PATCH', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10d53d030>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'POST', <_sre.SRE_Pattern object at 0x10de469b8>), (u'POST', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'POST', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10d53d030>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x7fcd835e9530>), (u'PUT', <_sre.SRE_Pattern object at 0x10de469b8>), (u'PUT', <_sre.SRE_Pattern object at 0x7fcd835e9f10>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>), (u'PUT', <_sre.SRE_Pattern object at 0x10ed9d1f8>)]
/tmp/moto-error/lib/python2.7/site-packages/responses.py:587: AssertionError
===================================== 1 failed in 1.21 seconds ======================================
[moto-error] craig@amogato2:/tmp
$ pip install moto==1.2
... output removed ...
[moto-error] craig@amogato2:/tmp
$ pytest test.py
======================================== test session starts ========================================
platform darwin -- Python 2.7.10, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /private/tmp, inifile:
plugins: responses-0.3.0
collected 1 item
test.py .
===================================== 1 passed in 0.90 seconds ======================================
I'm not sure there is a way for us to solve this. Although responses allows multiple mocks, I don't believe it will work properly with multiple mocks for the same global requests namespace.
Moto v1.3 causes my tests to fail if I set
responses.mock.assert_all_requests_are_fired = True
.I set
responses.mock.assert_all_requests_are_fired = True
to make sure that my application is behaving as expected, but since it doesn't make all the requests to all themoto
urls then my test fails.How to recreate
The text was updated successfully, but these errors were encountered: