Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris AtLee committed May 10, 2010
1 parent 3633085 commit 09af42b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions buildbot/test/regressions/test_import_unicode_changes.py
Expand Up @@ -36,7 +36,8 @@ def testUnicodeChange(self):
# Create changes.pck
changes = [Change(who=u"Frosty the \N{SNOWMAN}".encode("utf8"),
files=["foo"], comments=u"Frosty the \N{SNOWMAN}".encode("utf8"), branch="b1", revision=12345)]
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir, "changes.pck"), "w"))
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir,
"changes.pck"), "w"))

sm = manager.DBSchemaManager(self.spec, self.basedir)
sm.upgrade()
Expand All @@ -50,7 +51,8 @@ def testNonUnicodeChange(self):
# Create changes.pck
changes = [Change(who="\xff\xff\x00", files=["foo"],
comments="\xff\xff\x00", branch="b1", revision=12345)]
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir, "changes.pck"), "w"))
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir,
"changes.pck"), "w"))

sm = manager.DBSchemaManager(self.spec, self.basedir)
self.assertRaises(UnicodeDecodeError, sm.upgrade)
Expand All @@ -59,7 +61,8 @@ def testAsciiChange(self):
# Create changes.pck
changes = [Change(who="Frosty the Snowman",
files=["foo"], comments="Frosty the Snowman", branch="b1", revision=12345)]
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir, "changes.pck"), "w"))
cPickle.dump(Thing(changes=changes), open(os.path.join(self.basedir,
"changes.pck"), "w"))

sm = manager.DBSchemaManager(self.spec, self.basedir)
sm.upgrade()
Expand All @@ -77,7 +80,8 @@ def setUp(self):
os.makedirs(self.basedir)

# Now try the upgrade process, which will import the old changes.
self.spec = DBSpec.from_url("mysql://buildbot_test:buildbot_test@localhost/buildbot_test", self.basedir)
self.spec = DBSpec.from_url(
"mysql://buildbot_test:buildbot_test@localhost/buildbot_test", self.basedir)

self.db = DBConnector(self.spec)
self.db.start()
Expand All @@ -89,6 +93,7 @@ def setUp(self):

try:
import MySQLdb
conn = MySQLdb.connect(user="buildbot_test", db="buildbot_test", passwd="buildbot_test", use_unicode=True, charset='utf8')
conn = MySQLdb.connect(user="buildbot_test", db="buildbot_test",
passwd="buildbot_test", use_unicode=True, charset='utf8')
except:
TestMySQLDBUnicodeChanges.skip = True

0 comments on commit 09af42b

Please sign in to comment.