Skip to content

Commit

Permalink
remove timing dependency from irc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Jul 10, 2014
1 parent af5749f commit ce8b220
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions master/buildbot/test/unit/test_status_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Copyright Buildbot Team Members

import mock
import re

from buildbot.status import words
from buildbot.status.results import SUCCESS
Expand Down Expand Up @@ -370,13 +371,18 @@ def test_command_status_builder0_running(self):
def test_command_status_bogus(self):
yield self.do_test_command('status', args='bogus_builder', exp_UsageError=True)

def sub_seconds(self, strings):
# sometimes timing works out wrong, so just call it "n seconds"
return [re.sub(r'\d seconds', 'N seconds', s) for s in strings]

@defer.inlineCallbacks
def test_command_last(self):
self.setupSomeBuilds()
yield self.do_test_command('last')
self.assertEqual(len(self.sent), 2)
self.assertIn('last build [builder1]: last build 0 seconds ago: test', self.sent)
self.assertIn('last build [builder2]: (no builds run since last restart)', self.sent)
sent = self.sub_seconds(self.sent)
self.assertIn('last build [builder1]: last build N seconds ago: test', sent)
self.assertIn('last build [builder2]: (no builds run since last restart)', sent)

@defer.inlineCallbacks
def test_command_last_builder_bogus(self):
Expand All @@ -387,7 +393,8 @@ def test_command_last_builder0(self):
self.setupSomeBuilds()
yield self.do_test_command('last', args=self.BUILDER_NAMES[0])
self.assertEqual(len(self.sent), 1)
self.assertIn('last build [builder1]: last build 0 seconds ago: test', self.sent)
sent = self.sub_seconds(self.sent)
self.assertIn('last build [builder1]: last build N seconds ago: test', sent)

@defer.inlineCallbacks
def test_command_last_builder1(self):
Expand Down

0 comments on commit ce8b220

Please sign in to comment.