本文整理汇总了Python中monitor.Monitor.messages方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.messages方法的具体用法?Python Monitor.messages怎么用?Python Monitor.messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.messages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: multirepo_test
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import messages [as 别名]
class multirepo_test(object):
def setUp(self):
self.monitor = Monitor()
self.local_repos = []
self.remote_repos = []
for i in range(2):
r = LocalGit(bare=True)
r.install_post_receive_hook()
self.remote_repos.append(r)
l = LocalGit(clone=r)
open(l/init_py, 'w')
l.add(init_py)
l.commit()
self.local_repos.append(l)
print 'creating master...'
self.master = BuildMaster(config_fn = self.gen_config)
self.master.bot_dir.preserve()
self.master.create_master()
print 'starting master in', self.master.bot_dir, '...'
self.master.start()
print 'creating slave...'
self.slave = BuildSlave()
print 'starting slave...'
self.slave.bot_dir.preserve()
print 'setUp complete.'
def tearDown(self):
self.master.stop()
self.slave.stop()
del self.monitor
def gen_config(self, directory):
open(directory/'config.py', 'w').write(
config_template % dict(
repo0=self.remote_repos[0],
repo1=self.remote_repos[1]))
def test(self):
print 'starting test...'
repo = self.local_repos[0]
open(repo/init_py, 'w').write('invalid python\n')
repo.add(init_py)
repo.commit()
print 'commit #1 to', repo
repo.push()
open(repo/init_py, 'w').write('# valid python\n')
repo.add(init_py)
repo.commit()
print 'commit #2 to', repo
repo.push()
# self.master.stop()
for m in self.monitor.messages():
print '<== ', m['event'] # , 8*' ', m['payload']