discogs / pymongo-job-queue

MongoDB-based message queue
https://pypi.python.org/pypi/pymjq
MIT License
19 stars 20 forks source link

Iterator unit test #3

Open accraze opened 8 years ago

accraze commented 8 years ago

Need to figure out how to unit test JobQueue.__iter__... see https://github.com/discogs/pymongo-job-queue/blob/master/pymjq/test.py#L50

Due to the cursor staying open and waiting for new documents to enter the queue, this method never returns unless given a KeyboardInterrupt.

A possible solution might be to use a timeout decorator: https://pypi.python.org/pypi/timeout-decorator