Ejemplo n.º 1
0
	def emulateExecution(self, name,
			ok = True, running = False,
			project='myproject', client='myclient', **keyw) :
		s = Server("fixture")
		s = ArgPrepender(s, project, client, name)
		timestamp = "{:%Y-%m-%d %H:%M:%S}".format(
			datetime.datetime.strptime(name, "%Y%m%d-%H%M%S"))
		s.executionStarts(
			timestamp=timestamp,
			changelog=[])
		s.taskStarts(1,"First task")
		if running: return
		s.taskEnds(1,ok)
		s.executionEnds(ok)
Ejemplo n.º 2
0
	def test_isRunning_client_whenExecutionEnded(self) :
		s = Server("fixture")
		s.createServer()
		s.createProject("myproject")
		s.createClient("myproject", "myclient")

		s.executionStarts(
			"myproject", "myclient", "20130301-132313",
			timestamp="2013-03-01 13:23:13",
			changelog=[])

		s.executionEnds(
			"myproject", "myclient", "20130301-132313", True)

		self.assertEqual(
			s.isRunning("myproject","myclient"), False)
Ejemplo n.º 3
0
	def emulateExecution(client, name, tasks,
			project='myproject') :
		s = Server("fixture")
		s = ArgPrepender(s, project, client, name)
		timestamp = "{:%Y-%m-%d %H:%M:%S}".format(
			datetime.datetime.strptime(name, "%Y%m%d-%H%M%S"))
		s.executionStarts(
			timestamp=timestamp,
			changelog=[])
		for i, (task,commands) in enumerate(tasks) :
			s.taskStarts(i+1,task)
			for j, (line, ok, output, info, stats) in enumerate(commands) :
				s.commandStarts(i+1, j+1, line)
				if ok is None : return # Running or interrupted
				s.commandEnds(i+1, j+1,
					output=output,
					ok=ok,
					info=info,
					stats=stats)
				if ok is False : break # Failed, fatal for the task
			s.taskEnds(i+1,ok)
		s.executionEnds(ok)