def test_buildStarted_missing(self): """ If the slave associated to slave builder doesn not have a ``buildStarted`` method, calling ``buildStarted`` on the slave builder doesn't raise an exception. """ class ConcreteBuildSlave(AbstractBuildSlave): pass slave = ConcreteBuildSlave("slave", "pass") slavebuilder = AbstractSlaveBuilder() # FIXME: This should call attached, instead of setting the attribute # directly slavebuilder.slave = slave # The following shouldn't raise an exception. slavebuilder.buildStarted()
def test_buildStarted_called(self): """ If the slave associated to slave builder has a ``buildStarted`` method, calling ``buildStarted`` on the slave builder calls the method on the slave with the slavebuilder as an argument. """ class ConcreteBuildSlave(AbstractBuildSlave): _buildStartedCalls = [] def buildStarted(self, slavebuilder): self._buildStartedCalls.append(slavebuilder) slave = ConcreteBuildSlave("slave", "pass") slavebuilder = AbstractSlaveBuilder() # FIXME: This should call attached, instead of setting the attribute # directly slavebuilder.slave = slave slavebuilder.buildStarted() self.assertEqual(ConcreteBuildSlave._buildStartedCalls, [slavebuilder])
def slavebuilder_buildStarted(self): AbstractSlaveBuilder.buildStarted(self) if self.slave and hasattr(self.slave, 'buildStarted'): self.slave.buildStarted(self)