def remote_startCommand(self, stepref, stepId, command, args): """ This gets invoked by L{buildbot.process.step.RemoteCommand.start}, as part of various master-side BuildSteps, to start various commands that actually do the build. I return nothing. Eventually I will call .commandComplete() to notify the master-side RemoteCommand that I'm done. """ self.activity() if self.command: log.msg("leftover command, dropping it") self.stopCommand() try: factory = registry.getFactory(command) except KeyError: raise UnknownCommand("unrecognized WorkerCommand '%s'" % command) self.command = factory(self, stepId, args) log.msg(" startCommand:%s [id %s]" % (command, stepId)) self.remoteStep = stepref self.remoteStep.notifyOnDisconnect(self.lostRemoteStep) d = self.command.doStart() d.addCallback(lambda res: None) d.addBoth(self.commandComplete) return None
def test_all_commands_exist(self): # if this doesn't raise a KeyError, then we're good for n in registry.getAllCommandNames(): registry.getFactory(n)
def test_getFactory_KeyError(self): self.assertRaises(KeyError, lambda: registry.getFactory('nosuchcommand'))
def test_getFactory(self): factory = registry.getFactory('shell') self.assertEqual(factory, shell.WorkerShellCommand)