Example #1
0
    def test_topicconsumer(self):

        con_container = Queue()
        pro_container = Queue()        
        consumer =  QueueConsumer(con_container)
        producer =  QueueProducer(pro_container)
        browser = Browser('firefox')

        # login 和 browser 应该进行封装
        # fetcher, pusher, browser
        wait_login(browser)
        topicconsumer = TopicConsumer(consumer, producer, browser)

        

        for i in range(2):
            # 应该设计一个resolve url
            con_container.put("/question/20303645")
        con_container.put("DIE")


        topicconsumer.start()


        while 1:
            if con_container.qsize() == 0:
                break
            else:
                print("the size of queue : %s" % str(con_container.qsize()))
                time.sleep(10)

        # qsize根本用不了啊,  全是html,会很占带宽的
        # self.logger.info("长度 : %s " % pro_container)
        # self.assertEqual(pro_container.qsize(), 10, "获取的信息量有问题")

         # 所以,落地应该放在store存储这一层,由 consumer producer进行调用
        topicconsumer.close()
        topicconsumer.stop()
Example #2
0
 def test_wait_login(self):
     print("testing")
     login.wait_login(self.browser)