Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppEngine python unittest task queue

I have a AppEngine application that exposes some APIs. Right now I'm writing tests for those APIs but some of them enqueue tasks. I'm not sure how I can write a test case that waits for all the tasks that certain API call enqueued to finish.

Any ideas how within a test itself I can verify that certain tasks have finished?

like image 939
rzajac Avatar asked Feb 21 '23 21:02

rzajac


1 Answers

I assume you are using testbed.

Within testbed, enqueued tasks sit there until you execute them yourself. Since the test environment is single threaded, you manually execute the tasks in the queue and you know exactly when they are done.

This answer shows you how to manually execute tasks.

like image 192
gaefan Avatar answered Feb 27 '23 05:02

gaefan