MCPcopy
hub / github.com/celery/celery / test_raising

Method test_raising

t/unit/tasks/test_result.py:250–263  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

248 assert not pending_res.successful()
249
250 def test_raising(self):
251 notb = self.app.AsyncResult(self.task3['id'])
252 withtb = self.app.AsyncResult(self.task5['id'])
253
254 with pytest.raises(KeyError):
255 notb.get()
256 with pytest.raises(KeyError) as excinfo:
257 withtb.get()
258
259 tb = [t.strip() for t in traceback.format_tb(excinfo.tb)]
260 assert 'File "foo.py", line 2, in foofunc' not in tb
261 assert 'File "bar.py", line 3, in barfunc' not in tb
262 assert excinfo.value.args[0] == 'blue'
263 assert excinfo.typename == 'KeyError'
264
265 def test_raising_remote_tracebacks(self):
266 pytest.importorskip('tblib')

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
AsyncResultMethod · 0.45
raisesMethod · 0.45

Tested by

no test coverage detected