lister = <MagicMock name='PyPILister' id='139725843021048'>
swh_scheduler_celery_app = <Celery celery.tests at 0x7f1476d0d9b0>
swh_scheduler_celery_worker = <Worker: gen326@eb824b16fa38 (running)>
@patch("swh.lister.pypi.tasks.PyPILister")
def test_lister(lister, swh_scheduler_celery_app, swh_scheduler_celery_worker):
# setup the mocked PypiLister
lister.return_value = lister
lister.run.return_value = ListerStats(pages=1, origins=70)
res = swh_scheduler_celery_app.send_task("swh.lister.pypi.tasks.PyPIListerTask")
assert res
> res.wait()
.tox/py3/lib/python3.7/site-packages/swh/lister/pypi/tests/test_tasks.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/celery/result.py:230: in get
on_message=on_message,
.tox/py3/lib/python3.7/site-packages/celery/backends/base.py:659: in wait_for_pending
return result.maybe_throw(propagate=propagate, callback=callback)
.tox/py3/lib/python3.7/site-packages/celery/result.py:335: in maybe_throw
self.throw(value, self._to_remote_traceback(tb))
.tox/py3/lib/python3.7/site-packages/celery/result.py:328: in throw
self.on_ready.throw(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/vine/promises.py:234: in throw
reraise(type(exc), exc, tb)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tp = <class 'kombu.exceptions.EncodeError'>
value = EncodeError("TypeError('Object of type MagicMock is not JSON serializable')")
tb = None
def reraise(tp, value, tb=None):
"""Reraise exception."""
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
> raise value
E kombu.exceptions.EncodeError: TypeError('Object of type MagicMock is not JSON serializable')
.tox/py3/lib/python3.7/site-packages/vine/utils.py:30: EncodeError
TEST RESULT
TEST RESULT
- Run At
- Jan 14 2021, 6:59 PM