Skip to content

Commit

Permalink
Use 0/1 for hidden, since it's a smallint
Browse files Browse the repository at this point in the history
Fixes #3092.
  • Loading branch information
djmitche committed Dec 14, 2014
1 parent 65832db commit b113ad6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions master/buildbot/test/fake/fakedb.py
Expand Up @@ -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):
Expand Down Expand Up @@ -489,7 +490,7 @@ class Step(Row):
state_string='',
results=None,
urls_json='[]',
hidden=False)
hidden=0)

id_column = 'id'
foreignKeys = ('buildid',)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/unit/test_db_steps.py
Expand Up @@ -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),
Expand Down

0 comments on commit b113ad6

Please sign in to comment.