Пример #1
0
 def setUp(self):
     print 'setting up'
     EventLoopTest.setUp(self)
     # We want to store our database in a file, so that we can test
     # performance on a freshly opened db.
     save_path = FilenameType(self.make_temp_path(extension=".db"))
     if os.path.exists(save_path):
         os.unlink(save_path)
     self.reload_database(save_path)
     models.Feed(u'dtv:search')
     self.test_handler = messagetest.TestFrontendMessageHandler()
     messages.FrontendMessage.install_handler(self.test_handler)
     self.backend_message_handler = messagehandler.BackendMessageHandler(
         None)
     messages.BackendMessage.install_handler(self.backend_message_handler)
     self.feed = models.Feed(u'dtv:manualFeed')
     self.items = []
     template_file = self.make_temp_path(".avi")
     self.stats_path = self.make_temp_path(".prof")
     open(template_file, 'w').write(' ')
     app.bulk_sql_manager.start()
     for x in xrange(5000):
         path = self.make_temp_path(".avi")
         shutil.copyfile(template_file, path)
         models.FileItem(path, self.feed.id)
     app.bulk_sql_manager.finish()
     self.reload_database(save_path)
Пример #2
0
 def setUp(self):
     EventLoopTest.setUp(self)
     Feed(u'dtv:search')
     self.test_handler = TestFrontendMessageHandler()
     messages.FrontendMessage.install_handler(self.test_handler)
     self.backend_message_handler = messagehandler.BackendMessageHandler(
         None)
     messages.BackendMessage.install_handler(self.backend_message_handler)
     self.channelTabOrder = TabOrder(u'channel')
     self.playlistTabOrder = TabOrder(u'playlist')
     # Adding a guide ensures that if we remove all our
     # channel/playlist tabs the selection code won't go crazy.
     self.guide = ChannelGuide(app.config.get(prefs.CHANNEL_GUIDE_URL))
Пример #3
0
def install_message_handler():
    handler = messagehandler.BackendMessageHandler(on_frontend_started)
    messages.BackendMessage.install_handler(handler)