__wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f042810da60>
args = (<MagicMock name='mock.origin_update' id='139655806078144'>, [{'has_visits': True, 'last_eventful_visit_date': '2021-0...:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}])
kwargs = {}, __tracebackhide__ = True
msg = "Expected call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, '...\n [{'has_visits': True,\n 'last_even...\n \n ...Full output truncated (8 lines hidden), use '-vv' to show"
__mock_self = <MagicMock name='mock.origin_update' id='139655806078144'>
actual_args = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'nb_visits': 5, ...}],)
actual_kwargs = {}
introspection = "\nArgs:\nassert ([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)\n At index 0 diff: [{'url': 'http:/...\n [{'has_visits': True,\n 'last_even...\n \n ...Full output truncated (8 lines hidden), use '-vv' to show"
@py_assert2 = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}],)
@py_assert1 = None
@py_format4 = "([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)\n~At index 0 diff: [{'url': 'http://foobar.baz', 'ha...~ (\n~ [{'has_visits': True,\n~ 'last_even...\n~\n~...Full output truncated (8 lines hidden), use '-vv' to show"
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:414:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_mock_self = <MagicMock name='mock.origin_update' id='139655806078144'>
args = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}],)
kwargs = {}
expected = (([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}],), {})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f03e608a158>
actual = call([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}])
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: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_revision_date': '0001-01-01T00:00:00Z', 'last_release_date': '0001-01-01T00:00:00Z'}])
E Actual call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}])
/usr/lib/python3.7/unittest/mock.py:829: AssertionError
During handling of the above exception, another exception occurred:
__wrapped_mock_method__ = <function NonCallableMock.assert_called_once_with at 0x7f042810dae8>
args = (<MagicMock name='mock.origin_update' id='139655806078144'>, [{'has_visits': True, 'last_eventful_visit_date': '2021-0...:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}])
kwargs = {}, __tracebackhide__ = True
msg = "Expected call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, '...\n [{'has_visits': True,\n 'last_even...\n \n ...Full output truncated (8 lines hidden), use '-vv' to show"
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:414:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_mock_self = <MagicMock name='mock.origin_update' id='139655806078144'>
args = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}],)
kwargs = {}, self = <MagicMock name='mock.origin_update' id='139655806078144'>
def assert_called_once_with(_mock_self, *args, **kwargs):
"""assert that the mock was called exactly once and that that call was
with the specified arguments."""
self = _mock_self
if not self.call_count == 1:
msg = ("Expected '%s' to be called once. Called %s times." %
(self._mock_name or 'mock', self.call_count))
raise AssertionError(msg)
> return self.assert_called_with(*args, **kwargs)
/usr/lib/python3.7/unittest/mock.py:840:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<MagicMock name='mock.origin_update' id='139655806078144'>, [{'has_visits': True, 'last_eventful_visit_date': '2021-0...:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}])
kwargs = {}, __tracebackhide__ = True
def wrap_assert_called_with(*args: Any, **kwargs: Any) -> None:
__tracebackhide__ = True
> assert_wrapper(_mock_module_originals["assert_called_with"], *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:447:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
__wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f042810da60>
args = (<MagicMock name='mock.origin_update' id='139655806078144'>, [{'has_visits': True, 'last_eventful_visit_date': '2021-0...:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}])
kwargs = {}, __tracebackhide__ = True
msg = "Expected call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, '...\n [{'has_visits': True,\n 'last_even...\n \n ...Full output truncated (8 lines hidden), use '-vv' to show"
__mock_self = <MagicMock name='mock.origin_update' id='139655806078144'>
actual_args = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'nb_visits': 5, ...}],)
actual_kwargs = {}
introspection = "\nArgs:\nassert ([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)\n At index 0 diff: [{'url': 'http:/...\n [{'has_visits': True,\n 'last_even...\n \n ...Full output truncated (8 lines hidden), use '-vv' to show"
@py_assert2 = ([{'has_visits': True, 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_release_date': '0001-01-01T00:00:00Z', 'last_revision_date': '0001-01-01T00:00:00Z', ...}],)
@py_assert1 = None
@py_format4 = "([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)\n~At index 0 diff: [{'url': 'http://foobar.baz', 'ha...~ (\n~ [{'has_visits': True,\n~ 'last_even...\n~\n~...Full output truncated (8 lines hidden), use '-vv' to show"
def assert_wrapper(
__wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any
) -> None:
__tracebackhide__ = True
try:
__wrapped_mock_method__(*args, **kwargs)
return
except AssertionError as e:
if getattr(e, "_mock_introspection_applied", 0):
msg = str(e)
else:
__mock_self = args[0]
msg = str(e)
if __mock_self.call_args is not None:
actual_args, actual_kwargs = __mock_self.call_args
introspection = ""
try:
assert actual_args == args[1:]
except AssertionError as e_args:
introspection += "\nArgs:\n" + str(e_args)
try:
assert actual_kwargs == kwargs
except AssertionError as e_kwargs:
introspection += "\nKwargs:\n" + str(e_kwargs)
if introspection:
msg += "\n\npytest introspection follows:\n" + introspection
e = AssertionError(msg)
e._mock_introspection_applied = True # type:ignore[attr-defined]
> raise e
E AssertionError: Expected call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_revision_date': '0001-01-01T00:00:00Z', 'last_release_date': '0001-01-01T00:00:00Z'}])
E Actual call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}])
E
E pytest introspection follows:
E
E Args:
E assert ([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)
E At index 0 diff: [{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}] != [{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_revision_date': '0001-01-01T00:00:00Z', 'last_release_date': '0001-01-01T00:00:00Z'}]
E Full diff:
E (
E [{'has_visits': True,
E 'last_even...
E
E ...Full output truncated (8 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:437: AssertionError
During handling of the above exception, another exception occurred:
def test_journal_client_origin_visit_status_from_journal():
search_mock = MagicMock()
worker_fn = functools.partial(process_journal_objects, search=search_mock,)
current_datetime = datetime.now(tz=timezone.utc)
worker_fn(
{
"origin_visit_status": [
{
"origin": "http://foobar.baz",
"status": "full",
"visit": 5,
"date": current_datetime,
"snapshot": None,
} # full visits ok
]
}
)
search_mock.origin_update.assert_called_once_with(
[
{
"url": "http://foobar.baz",
"has_visits": True,
"nb_visits": 5,
"snapshot_id": None,
"last_visit_date": current_datetime.isoformat(),
"last_eventful_visit_date": current_datetime.isoformat(),
"last_revision_date": "0001-01-01T00:00:00Z",
> "last_release_date": "0001-01-01T00:00:00Z",
},
]
)
E AssertionError: Expected call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_revision_date': '0001-01-01T00:00:00Z', 'last_release_date': '0001-01-01T00:00:00Z'}])
E Actual call: origin_update([{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}])
E
E pytest introspection follows:
E
E Args:
E assert ([{'has_visit...s': 5, ...}],) == ([{'has_visit...:00Z', ...}],)
E At index 0 diff: [{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00'}] != [{'url': 'http://foobar.baz', 'has_visits': True, 'nb_visits': 5, 'snapshot_id': None, 'last_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_eventful_visit_date': '2021-06-18T11:27:32.188305+00:00', 'last_revision_date': '0001-01-01T00:00:00Z', 'last_release_date': '0001-01-01T00:00:00Z'}]
E Full diff:
E (
E [{'has_visits': True,
E 'last_even...
E
E ...Full output truncated (8 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_journal_client.py:71: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 18 2021, 1:27 PM