Skip to content

Commit

Permalink
add a BuildStep.isNewStyle method
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Dec 16, 2013
1 parent 6a57249 commit 3c09d04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions master/buildbot/process/buildstep.py
Expand Up @@ -486,6 +486,10 @@ def failed(self, why):
"failed() can only be called from old steps implementing start()"
self._start_deferred.errback(why)

def isNewStyle(self):
# **temporary** method until new-style steps are the only supported style
return self.run.__func__ is not BuildStep.run.__func__

def start(self):
raise NotImplementedError("your subclass must implement run()")

Expand Down
16 changes: 16 additions & 0 deletions master/buildbot/test/unit/test_process_buildstep.py
Expand Up @@ -51,6 +51,18 @@ class FakeStepStatus:
pass


class OldStyleStep(buildstep.BuildStep):

def start(self):
pass


class NewStyleStep(buildstep.BuildStep):

def run(self):
pass


class TestRegexLogEvaluator(unittest.TestCase):

def makeRemoteCommand(self, rc, stdout, stderr=''):
Expand Down Expand Up @@ -340,6 +352,10 @@ def test_getStatistics(self):
step.setStatistic('ba', 0.298)
self.assertEqual(step.getStatistics(), {'rbi': 13, 'ba': 0.298})

def test_isNewStyle(self):
self.assertFalse(OldStyleStep().isNewStyle())
self.assertTrue(NewStyleStep().isNewStyle())


class TestLoggingBuildStep(unittest.TestCase):

Expand Down

0 comments on commit 3c09d04

Please sign in to comment.