Skip to content

Commit

Permalink
Merge pull request #2636 from rodrigc/isort_fix
Browse files Browse the repository at this point in the history
Fix whitespace to appease 'make isort'.
  • Loading branch information
tardyp committed Jan 20, 2017
2 parents 35a5392 + d206213 commit 37fdab5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Expand Up @@ -15,6 +15,7 @@

from __future__ import absolute_import
from __future__ import print_function

import sqlalchemy as sa
from migrate import changeset

Expand All @@ -24,8 +25,10 @@ def upgrade(migrate_engine):
metadata.bind = migrate_engine

if migrate_engine.dialect.name == "postgresql":
# changeset.alter_column has no effect on postgres, so we do this with raw sql
migrate_engine.execute("alter table change_properties alter column property_value type text")
# changeset.alter_column has no effect on postgres, so we do this with
# raw sql
migrate_engine.execute(
"alter table change_properties alter column property_value type text")

else:
# Commit messages can get too big for the normal 1024 String limit.
Expand Down
Expand Up @@ -15,10 +15,14 @@

from __future__ import absolute_import
from __future__ import print_function

from random import choice
from string import ascii_lowercase

import sqlalchemy as sa

from twisted.trial import unittest

from buildbot.test.util import migration
from buildbot.util import sautils

Expand Down Expand Up @@ -52,11 +56,14 @@ def verify_thd(conn):
metadata = sa.MetaData()
metadata.bind = conn
random_length = 65535
random_string = ''.join(choice(ascii_lowercase) for byte in range(random_length))
random_string = ''.join(choice(ascii_lowercase)
for byte in range(random_length))

# Verify column type is text
change_properties = sautils.Table('change_properties', metadata, autoload=True)
self.assertIsInstance(change_properties.c.property_value.type, sa.Text)
change_properties = sautils.Table(
'change_properties', metadata, autoload=True)
self.assertIsInstance(
change_properties.c.property_value.type, sa.Text)

# Test write and read random string
conn.execute(change_properties.insert(), [dict(
Expand All @@ -66,6 +73,7 @@ def verify_thd(conn):
)])
q = conn.execute(sa.select(
[change_properties.c.property_value]).where(change_properties.c.changeid == 1))
[self.assertEqual(q_string[0].encode("ascii"), random_string) for q_string in q]
[self.assertEqual(q_string[0].encode("ascii"), random_string)
for q_string in q]

return self.do_test_migration(47, 48, setup_thd, verify_thd)

0 comments on commit 37fdab5

Please sign in to comment.