From b113ad674bb4c2bd9c6690ef89e30dea9fa4a632 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 14 Dec 2014 14:33:53 -0500 Subject: [PATCH] Use 0/1 for hidden, since it's a smallint Fixes #3092. --- master/buildbot/test/fake/fakedb.py | 26 ++++++++++++++-------- master/buildbot/test/unit/test_db_steps.py | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/master/buildbot/test/fake/fakedb.py b/master/buildbot/test/fake/fakedb.py index 206b9c9af40..1d92579c41d 100644 --- a/master/buildbot/test/fake/fakedb.py +++ b/master/buildbot/test/fake/fakedb.py @@ -139,7 +139,8 @@ def checkForeignKeys(self, db, t): t.assertTrue(val is not None, "foreign key %s:%r does not exit" % (foreign_key, key)) else: - raise ValueError("warning, unsupported foreign key", foreign_key, self.table) + raise ValueError( + "warning, unsupported foreign key", foreign_key, self.table) class BuildRequest(Row): @@ -489,7 +490,7 @@ class Step(Row): state_string='', results=None, urls_json='[]', - hidden=False) + hidden=0) id_column = 'id' foreignKeys = ('buildid',) @@ -854,7 +855,8 @@ def assertChange(self, changeid, row): # 1 parent for a change. # When we will support multiple parent for change, then we will have a # table parent_changes with at least 2 col: "changeid", "parent_changeid" - # And the col 'parent_changeids' of the table changes will be dropped + # And the col 'parent_changeids' of the table changes will be + # dropped row_only['parent_changeids'] = None self.t.assertEqual(row_only, row.values) @@ -912,7 +914,8 @@ def insertTestData(self, rows): # component methods def classifyChanges(self, schedulerid, classifications): - self.classifications.setdefault(schedulerid, {}).update(classifications) + self.classifications.setdefault( + schedulerid, {}).update(classifications) return defer.succeed(None) def flushChangeClassifications(self, schedulerid, less_than=None): @@ -1171,7 +1174,8 @@ def addBuildset(self, sourcestamps, reason, properties, builderids, waited_for, parent_buildid=None, parent_relationship=None, _reactor=reactor): # We've gotten this wrong a couple times. - assert isinstance(waited_for, bool), 'waited_for should be boolean: %r' % waited_for + assert isinstance( + waited_for, bool), 'waited_for should be boolean: %r' % waited_for # calculate submitted at if submitted_at: @@ -1297,7 +1301,8 @@ def fakeBuildsetCompletion(self, bsid, result): def assertBuildsetCompletion(self, bsid, complete): """Assert that the completion state of buildset BSID is COMPLETE""" actual = self.buildsets[bsid]['complete'] - self.t.failUnless((actual and complete) or (not actual and not complete)) + self.t.failUnless( + (actual and complete) or (not actual and not complete)) def assertBuildset(self, bsid=None, expected_buildset=None): """Assert that the given buildset looks as expected; the ssid parameter @@ -1727,7 +1732,8 @@ def insertTestData(self, rows): for row in rows: if isinstance(row, BuildProperty): assert row.buildid in self.builds - self.builds[row.buildid]['properties'][row.name] = (row.value, row.source) + self.builds[row.buildid]['properties'][ + row.name] = (row.value, row.source) # component methods @@ -1966,7 +1972,8 @@ def insertTestData(self, rows): # make sure there are enough slots in the list if len(lines) < row.last_line + 1: lines.append([None] * (row.last_line + 1 - len(lines))) - lines[row.first_line:row.last_line + 1] = row.content.split('\n') + lines[ + row.first_line:row.last_line + 1] = row.content.split('\n') # component methods @@ -2306,7 +2313,8 @@ def updateBuilderInfo(self, builderid, description, tags): def _row2dict(self, row): row = row.copy() - row['tags'] = [self.db.tags.tags[tagid]['name'] for tagid in self.builders_tags.get(row['id'], [])] + row['tags'] = [self.db.tags.tags[tagid]['name'] + for tagid in self.builders_tags.get(row['id'], [])] return row diff --git a/master/buildbot/test/unit/test_db_steps.py b/master/buildbot/test/unit/test_db_steps.py index 977d6522929..7aad869ce0b 100644 --- a/master/buildbot/test/unit/test_db_steps.py +++ b/master/buildbot/test/unit/test_db_steps.py @@ -55,7 +55,7 @@ class Tests(interfaces.InterfaceTests): started_at=TIME2, complete_at=TIME3, state_string=u'test', results=2, urls_json=u'["http://url"]', - hidden=True), + hidden=1), fakedb.Step(id=72, number=2, name='three', buildid=30, started_at=TIME3), fakedb.Step(id=73, number=0, name='wrong-build', buildid=31),