__wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f54f816ff28>
args = (<MagicMock name='get' spec='method' id='140002778776520'>, 'https://replicate.npmjs.com/_changes')
kwargs = {'params': {'include_docs': 'true', 'limit': 2, 'since': 67}}
__tracebackhide__ = True
msg = "Expected call: get('https://replicate.npmjs.com/_changes', params={'limit': 2, 'include_docs': 'true', 'since': 67})\...'include_docs': 'true', 'limit': 2, 'since': '67'}}\n ? + +"
__mock_self = <MagicMock name='get' spec='method' id='140002778776520'>
actual_args = ('https://replicate.npmjs.com/_changes',)
actual_kwargs = {'params': {'include_docs': 'true', 'limit': 2, 'since': '67'}}
introspection = "\nKwargs:\nassert {'params': {'...since': '67'}} == {'params': {'... 'since': 67}}\n Differing items:\n {'params': ...'include_docs': 'true', 'limit': 2, 'since': '67'}}\n ? + +"
@py_assert2 = None, @py_assert1 = False
def assert_wrapper(
__wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any
) -> None:
__tracebackhide__ = True
try:
> __wrapped_mock_method__(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:392:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_mock_self = <MagicMock name='get' spec='method' id='140002778776520'>
args = ('https://replicate.npmjs.com/_changes',)
kwargs = {'params': {'include_docs': 'true', 'limit': 2, 'since': 67}}
expected = ('', <BoundArguments (url='https://replicate.npmjs.com/_changes', kwargs={'params': {'limit': 2, 'include_docs': 'true', 'since': 67}})>)
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f54eff0c510>
actual = ('', <BoundArguments (url='https://replicate.npmjs.com/_changes', kwargs={'params': {'limit': 2, 'include_docs': 'true', 'since': '67'}})>)
cause = None
def assert_called_with(_mock_self, *args, **kwargs):
"""assert that the mock was called with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
self = _mock_self
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
raise AssertionError('Expected call: %s\nNot called' % (expected,))
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher((args, kwargs))
actual = self._call_matcher(self.call_args)
if expected != actual:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: Expected call: get('https://replicate.npmjs.com/_changes', params={'limit': 2, 'include_docs': 'true', 'since': 67})
E Actual call: get('https://replicate.npmjs.com/_changes', params={'limit': 2, 'include_docs': 'true', 'since': '67'})
/usr/lib/python3.7/unittest/mock.py:829: AssertionError
During handling of the above exception, another exception occurred:
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f54efdf4128>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f54efdf4828>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f54efdf4da0>
def test_npm_lister_incremental_restart(
swh_scheduler, requests_mock, mocker,
):
"""Check incremental npm listing will restart from saved state"""
page_size = 2
last_seq = 67
lister = NpmLister(scheduler=swh_scheduler, page_size=page_size, incremental=True)
lister.state = NpmListerState(last_seq=last_seq)
requests_mock.get(lister.API_INCREMENTAL_LISTING_URL, json={"results": []})
spy_get = mocker.spy(lister.session, "get")
lister.run()
spy_get.assert_called_with(
lister.API_INCREMENTAL_LISTING_URL,
> params=_url_params(page_size, since=last_seq),
)
.tox/py3/lib/python3.7/site-packages/swh/lister/npm/tests/test_lister.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('https://replicate.npmjs.com/_changes',)
kwargs = {'params': {'include_docs': 'true', 'limit': 2, 'since': 67}}
def assert_called_with(*args, **kwargs):
> return mock.assert_called_with(*args, **kwargs)
E AssertionError: Expected call: get('https://replicate.npmjs.com/_changes', params={'limit': 2, 'include_docs': 'true', 'since': 67})
E Actual call: get('https://replicate.npmjs.com/_changes', params={'limit': 2, 'include_docs': 'true', 'since': '67'})
E
E pytest introspection follows:
E
E Kwargs:
E assert {'params': {'...since': '67'}} == {'params': {'... 'since': 67}}
E Differing items:
E {'params': {'include_docs': 'true', 'limit': 2, 'since': '67'}} != {'params': {'include_docs': 'true', 'limit': 2, 'since': 67}}
E Full diff:
E - {'params': {'include_docs': 'true', 'limit': 2, 'since': 67}}
E + {'params': {'include_docs': 'true', 'limit': 2, 'since': '67'}}
E ? + +
/usr/lib/python3.7/unittest/mock.py:187: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jan 20 2021, 5:30 PM