Skip to content

Commit

Permalink
only check that assertion is raised on fake DB
Browse files Browse the repository at this point in the history
and don't unit-test the Python interpreter's scoping rules..
  • Loading branch information
djmitche committed Aug 21, 2013
1 parent 0e12bca commit 1463de8
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions master/buildbot/test/unit/test_db_buildsets.py
Expand Up @@ -499,21 +499,6 @@ def thd(conn):
d.addCallback(check)
return d

@defer.inlineCallbacks
def test_addBuildset_bad_waited_for(self):
try:
result = yield self.db.buildsets.addBuildset(sourcestamps=[234], reason='because',
properties={}, builderNames=['bldr'], external_idstring='extid',
waited_for='wat', _reactor=self.clock)
except Exception, actual_exception:
pass
else:
actual_exception = None

self.assertIdentical(AssertionError, type(actual_exception))
self.assertRaises(NameError, lambda: result)
self.assertEqual(("waited_for should be boolean: 'wat'",), actual_exception.args)



class TestFakeDB(unittest.TestCase, Tests):
Expand All @@ -524,6 +509,13 @@ def setUp(self):
self.insertTestData = self.db.insertTestData
return self.setUpTests()

def test_addBuildset_bad_waited_for(self):
# only the fake db asserts on the type of waited_for
d = self.db.buildsets.addBuildset(sourcestamps=[234], reason='because',
properties={}, builderNames=['bldr'], external_idstring='extid',
waited_for='wat', _reactor=self.clock)
self.assertFailure(d, AssertionError)


class TestRealDB(unittest.TestCase,
connector_component.ConnectorComponentMixin,
Expand Down

0 comments on commit 1463de8

Please sign in to comment.