Esempio n. 1
0
class APITestcase(_Testcase):

    def setUp(self):

        self.api = SearchAPI()

    @with_httmock(
        load_googleplay_terminator,
        load_appleitunes_terminator,
        load_netflix_terminator,
    )
    def test_api(self):

        queue = JoinableQueue()
        task_group = self.api.search('terminator', queue)

        while True:
            finished = all(
                [greenlet.ready() for greenlet in task_group.greenlets]
            )
            try:
                item = queue.get(timeout=1.0)
            except Empty:

                if finished:
                    log.info('queue is empty and all jobs are done, quitting')
                    break

                log.info(
                    'queue was empty and jobs are still running, retrying'
                )

                continue

            try:
                log.info('%r', item)
            finally:
                queue.task_done()

        task_group.join()
        queue.join()

        log.info('joined everything')
Esempio n. 2
0
class APITestcase(_Testcase):
    def setUp(self):

        self.api = SearchAPI()

    @with_httmock(
        load_googleplay_terminator,
        load_appleitunes_terminator,
        load_netflix_terminator,
    )
    def test_api(self):

        queue = JoinableQueue()
        task_group = self.api.search('terminator', queue)

        while True:
            finished = all(
                [greenlet.ready() for greenlet in task_group.greenlets])
            try:
                item = queue.get(timeout=1.0)
            except Empty:

                if finished:
                    log.info('queue is empty and all jobs are done, quitting')
                    break

                log.info(
                    'queue was empty and jobs are still running, retrying')

                continue

            try:
                log.info('%r', item)
            finally:
                queue.task_done()

        task_group.join()
        queue.join()

        log.info('joined everything')
Esempio n. 3
0
    def setUp(self):

        self.api = SearchAPI()
Esempio n. 4
0
    def setUp(self):

        self.api = SearchAPI()