当前位置: 首页>>代码示例>>Python>>正文


Python EventLoopTest.setUp方法代码示例

本文整理汇总了Python中miro.test.framework.EventLoopTest.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python EventLoopTest.setUp方法的具体用法?Python EventLoopTest.setUp怎么用?Python EventLoopTest.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在miro.test.framework.EventLoopTest的用法示例。


在下文中一共展示了EventLoopTest.setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     # need to call setup_tabs for PlaylistTracker() and
     # ChannelTracker()
     startup.setup_tabs()
     self.setup_config()
     self.setup_data()
开发者ID:CodeforEvolution,项目名称:miro,代码行数:9,代码来源:sharingtest.py

示例2: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     # override the normal handler class with our own
     workerprocess._subprocess_manager.handler_class = (
             UnittestWorkerProcessHandler)
     workerprocess._subprocess_manager.restart_delay = 0
     self.reset_results()
开发者ID:ShriramK,项目名称:miro,代码行数:9,代码来源:subprocesstest.py

示例3: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.feed = Feed(u"http://feed.uk")
     self.i1 = Item(FeedParserValues({"title": u"item1"}), feed_id=self.feed.id)
     self.i2 = Item(FeedParserValues({"title": u"item2"}), feed_id=self.feed.id)
     self.i3 = Item(FeedParserValues({"title": u"item3"}), feed_id=self.feed.id)
     self.i4 = Item(FeedParserValues({"title": u"item4"}), feed_id=self.feed.id)
开发者ID:ktan2020,项目名称:miro,代码行数:9,代码来源:playlisttest.py

示例4: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 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)
开发者ID:cool-RR,项目名称:Miro,代码行数:28,代码来源:performancetest.py

示例5: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
    def setUp(self):
        EventLoopTest.setUp(self)

        self.responder = TestSubprocessResponder()
        self.subprocess = subprocessmanager.SubprocessManager(TestMessage,
                self.responder, TestSubprocessHandler)
        self.subprocess.start()
        self._wait_for_subprocess_ready()
开发者ID:kmshi,项目名称:miro,代码行数:10,代码来源:subprocesstest.py

示例6: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.start_http_server()
     self.grab_url_info = self.grab_url_error = None
     self.expecting_errback = False
     self.event_loop_timeout = 1.0
     test_txt_path = resources.path("testdata/httpserver/test.txt")
     self.test_response_data = open(test_txt_path).read()
开发者ID:bluezone,项目名称:miro,代码行数:10,代码来源:httpclienttest.py

示例7: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     app.directory_watcher = FakeDirectoryWatcher
     self.dir = self.make_temp_dir_path()
     self.url = u'dtv:directoryfeed:%s' % make_url_safe(self.dir)
     self.feed = models.Feed(self.url)
     self.source_path = resources.path("testdata/pop.mp3")
     self.directory_watcher = self.feed.actualFeed.watcher
     # not having to wait for a timeout makes the tests simpler and faster
     self.feed.actualFeed.DIRECTORY_WATCH_UPDATE_TIMEOUT = 0.0
开发者ID:codito,项目名称:miro,代码行数:12,代码来源:watchedfoldertest.py

示例8: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.feed = Feed(u"http://feed.uk")
     self.i1 = Item(FeedParserValues({'title': u'item1'}),
                    feed_id=self.feed.id)
     self.i2 = Item(FeedParserValues({'title': u'item2'}),
                    feed_id=self.feed.id)
     self.i3 = Item(FeedParserValues({'title': u'item3'}),
                    feed_id=self.feed.id)
     self.i4 = Item(FeedParserValues({'title': u'item4'}),
                    feed_id=self.feed.id)
开发者ID:cool-RR,项目名称:Miro,代码行数:13,代码来源:playlisttest.py

示例9: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 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))
开发者ID:ShriramK,项目名称:miro,代码行数:15,代码来源:messagetest.py

示例10: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.updater = metadataprogress.MetadataProgressUpdater()
     # make messages send immediately to speed up test execution
     self.updater.message_interval = 0.0
     # setup a fake device to use
     self.device = mock.Mock()
     self.device.id = 123
     # make our handler
     self.test_handler = TestFrontendMessageHandler()
     messages.FrontendMessage.install_handler(self.test_handler)
     # the warnings from MetadataProgressUpdater should be errors in the
     # test case
     self.log_filter.set_exception_level(logging.WARNING)
开发者ID:codito,项目名称:miro,代码行数:16,代码来源:messagetest.py

示例11: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     download.chatter = False
     download.next_free_filename = lambda x: self.make_temp_path_fileobj()
     download._downloads = {}
     self.start_http_server()
     # screen-redirect is a 302 redirect to linux-screen.jpg, which is a
     # fairly big file.  The idea is to try to mimic a real-world item,
     # which often have redirects.
     self.download_url = unicode(
             self.httpserver.build_url('screen-redirect'))
     self.download_path = resources.path(
             'testdata/httpserver/linux-screen.jpg')
     self.event_loop_timeout = 0.5
     self.download_size = 45572
开发者ID:ShriramK,项目名称:miro,代码行数:17,代码来源:httpdownloadertest.py

示例12: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
    def setUp(self):
        EventLoopTest.setUp(self)
        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.bind( ('127.0.0.1', 0) )
        server.listen(1)
        address = server.getsockname()

        self.connectionHandler = TestingConnectionHandler(self)
        def stopEventLoop(conn):
            self.stopEventLoop(False)
        self.connectionHandler.open_connection(address[0], address[1],
                stopEventLoop, stopEventLoop)
        self.runEventLoop()
        self.remoteSocket, address = server.accept()
        self.remoteSocket.setblocking(False)
开发者ID:cool-RR,项目名称:Miro,代码行数:17,代码来源:networktest.py

示例13: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.feed = Feed(u'dtv:manualFeed', initiallyAutoDownloadable=False)
     self.mytempdir = FilenameType(tempfile.mkdtemp(dir=self.tempdir))
     self._make_fake_item("pcf.avi")
     self._make_fake_item("dean.avi")
     self._make_fake_item("npr.txt")
     self.container_item = FileItem(self.mytempdir, self.feed.id)
     # Give the iterators some time to run
     self.process_idles()
     for child in self.container_item.get_children():
         if child.filename.endswith("avi"):
             child.file_type = u'video'
         else:
             child.file_type = u'other'
         child.signal_change()
开发者ID:CodeforEvolution,项目名称:miro,代码行数:18,代码来源:itemtest.py

示例14: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.share = testobjects.make_share()
     self.playlist_item_map = mappings.SharingItemPlaylistMap(
         self.share.db_info.db.connection)
     # Replace threading.Thread() with a mock object so that
     # SharingItemTrackerImpl objects don't create real theads.
     self.patch_for_test('threading.Thread')
     # Replace update_started() and update_finished() with mock objects.
     # We want to ignore the TabsChanged messages that they send out.
     self.patch_for_test('miro.sharing.Share.update_started')
     self.patch_for_test('miro.sharing.Share.update_finished')
     # also use a Mock object for the daap client
     self.client = testobjects.MockDAAPClient()
     self.patch_for_test('miro.libdaap.make_daap_client',
                         self.client.returnself)
     self.MockTabsChanged = self.patch_for_test(
         'miro.messages.TabsChanged')
开发者ID:nicolasembleton,项目名称:miro,代码行数:20,代码来源:sharingtest.py

示例15: setUp

# 需要导入模块: from miro.test.framework import EventLoopTest [as 别名]
# 或者: from miro.test.framework.EventLoopTest import setUp [as 别名]
 def setUp(self):
     EventLoopTest.setUp(self)
     self.event_loop_timeout = 20
     self.start_http_server()
开发者ID:ShriramK,项目名称:miro,代码行数:6,代码来源:flashscrapertest.py


注:本文中的miro.test.framework.EventLoopTest.setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。