def testT(self, taskqueue, fastndb): task(T, 'T').enqueue() consume(taskqueue) assert [['T1', 'T2']] == messages assert _Result.query().fetch() == [] assert queue.Lock.model.query().fetch() == []
def testB(self, taskqueue, ndb): A = task(CACHED).enqueue(name='A') B = task(CACHED).enqueue(name='B') assert count_tasks(taskqueue) == 2 tick(taskqueue) assert count_tasks(taskqueue) == 2 tick(taskqueue) assert count_tasks(taskqueue) == 0 assert 'ONCE ONCE'.split() == messages
def T(message): rv = yield task(ECHO, message) yield task(ECHO, '1'), task(ECHO, '2') rv = yield task(ECHO, rv + '1'), task(ECHO, rv + '2') rv = yield task(ECHO, rv) messages.append(rv) raise Return(rv)
def testYieldPlainValue(self, taskqueue, ndb): task(Y, task(YieldPlainValue)).run() consume(taskqueue) assert ['VALUE'] == messages assert _Result.query().fetch() == []
def testCallAbort(self, taskqueue, ndb): task(Y, task(CallAbort)).run() consume(taskqueue) assert [] == messages assert _Result.query().fetch() == []
def testRaisePermanentFailure(self, taskqueue, fastndb): task(Y, task(RaisePermanentFailure)).run() consume(taskqueue) assert [] == messages assert _Result.query().fetch() == []
def testB(self, taskqueue, ndb): task(Y, task(B)).run() consume(taskqueue) assert ['B'] == messages assert _Result.query().fetch() == []
def testNested(self, taskqueue, fastndb): task(Nested).enqueue() consume(taskqueue) assert "Nested Level1 Level2 Level1 Nested Done".split() == messages assert _Result.query().fetch() == []
def CACHED(): yield task(ONCE)
def Nested(): messages.append('Nested') yield task(Level1) messages.append('Done')
def Level1(): messages.append('Level1') yield task(Level2)