Rev 2755: (Lukáš Lalinský) Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Aug 28 06:54:24 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2755
revision-id: pqm at pqm.ubuntu.com-20070828055422-9h8abp4darakavba
parent: pqm at pqm.ubuntu.com-20070828050922-e7ovfulum5c7sd5o
parent: ian.clatworthy at internode.on.net-20070828051817-nq5t94pfqvsuwoyx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-08-28 06:54:22 +0100
message:
(Lukáš Lalinský) Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/commands/test_missing.py test_missing.py-20070525171057-qr1z4sleurlp9b5v-1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 2754.1.1
merged: ian.clatworthy at internode.on.net-20070828051817-nq5t94pfqvsuwoyx
parent: pqm at pqm.ubuntu.com-20070828050922-e7ovfulum5c7sd5o
parent: lalinsky at gmail.com-20070816173650-772z26k64nv7uq2k
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: ianc-integration
timestamp: Tue 2007-08-28 15:18:17 +1000
message:
(Lukáš Lalinský) Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names
------------------------------------------------------------
revno: 2717.1.1
merged: lalinsky at gmail.com-20070816173650-772z26k64nv7uq2k
parent: pqm at pqm.ubuntu.com-20070816153342-vx6qu7u23qs035vy
committer: Lukáš Lalinsky <lalinsky at gmail.com>
branch nick: log-selftest
timestamp: Thu 2007-08-16 19:36:50 +0200
message:
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names.
=== modified file 'NEWS'
--- a/NEWS 2007-08-28 04:34:10 +0000
+++ b/NEWS 2007-08-28 05:18:17 +0000
@@ -89,6 +89,11 @@
incremental addition of data to a file without requiring that all the
data be buffered in memory. (Robert Collins)
+ TESTING:
+
+ * Use UTF-8 encoded StringIO for log tests to avoid failures on
+ non-ASCII committer names. (Lukáš Lalinský)
+
bzr 0.90 2007-08-??
===================
@@ -111,6 +116,7 @@
is deprecated. Callers should instead create a ``BzrDir`` instance
and call ``create_repository`` on that. (Martin Pool)
+
bzr 0.90rc1 2007-08-14
======================
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2007-08-21 03:53:07 +0000
+++ b/bzrlib/tests/__init__.py 2007-08-28 05:18:17 +0000
@@ -1671,6 +1671,18 @@
self.addCleanup(resetTimeout)
bzrlib.lockdir._DEFAULT_TIMEOUT_SECONDS = 0
+ def make_utf8_encoded_stringio(self, encoding_type=None):
+ """Return a StringIOWrapper instance, that will encode Unicode
+ input to UTF-8.
+ """
+ if encoding_type is None:
+ encoding_type = 'strict'
+ sio = StringIO()
+ output_encoding = 'utf-8'
+ sio = codecs.getwriter(output_encoding)(sio, errors=encoding_type)
+ sio.encoding = output_encoding
+ return sio
+
class TestCaseWithMemoryTransport(TestCase):
"""Common test class for tests that do not need disk resources.
=== modified file 'bzrlib/tests/commands/test_missing.py'
--- a/bzrlib/tests/commands/test_missing.py 2007-07-20 16:57:41 +0000
+++ b/bzrlib/tests/commands/test_missing.py 2007-08-16 17:36:50 +0000
@@ -16,7 +16,6 @@
from bzrlib.builtins import cmd_missing
-from bzrlib.tests import StringIOWrapper
from bzrlib.tests.transport_util import TestCaseWithConnectionHookedTransport
@@ -33,7 +32,7 @@
cmd = cmd_missing()
# We don't care about the ouput but 'outf' should be defined
- cmd.outf = StringIOWrapper()
+ cmd.outf = self.make_utf8_encoded_stringio()
cmd.run(self.get_url('branch2'))
self.assertEquals(1, len(self.connections))
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2007-08-15 16:05:13 +0000
+++ b/bzrlib/tests/test_log.py 2007-08-16 17:36:50 +0000
@@ -103,9 +103,11 @@
self.build_tree(['hello'])
wt.add('hello')
- wt.commit('add one file')
+ wt.commit('add one file',
+ committer=u'\u013d\xf3r\xe9m \xcdp\u0161\xfam '
+ u'<test at example.com>')
- lf = StringIO()
+ lf = self.make_utf8_encoded_stringio()
# log using regular thing
show_log(b, LongLogFormatter(lf))
lf.seek(0)
@@ -220,7 +222,7 @@
def test_trailing_newlines(self):
wt = self.make_branch_and_tree('.')
b = make_commits_with_trailing_newlines(wt)
- sio = StringIO()
+ sio = self.make_utf8_encoded_stringio()
lf = ShortLogFormatter(to_file=sio)
show_log(b, lf)
self.assertEquals(sio.getvalue(), """\
@@ -301,7 +303,7 @@
self.run_bzr('merge ../child')
wt.commit('merge branch 1')
b = wt.branch
- sio = StringIO()
+ sio = self.make_utf8_encoded_stringio()
lf = LongLogFormatter(to_file=sio)
show_log(b, lf, verbose=True)
log = self.normalize_log(sio.getvalue())
@@ -357,7 +359,7 @@
self.run_bzr('merge ../child')
wt.commit('merge branch 1')
b = wt.branch
- sio = StringIO()
+ sio = self.make_utf8_encoded_stringio()
lf = LongLogFormatter(to_file=sio)
show_log(b, lf, verbose=True)
log = self.normalize_log(sio.getvalue())
@@ -399,7 +401,7 @@
def test_trailing_newlines(self):
wt = self.make_branch_and_tree('.')
b = make_commits_with_trailing_newlines(wt)
- sio = StringIO()
+ sio = self.make_utf8_encoded_stringio()
lf = LongLogFormatter(to_file=sio)
show_log(b, lf)
self.assertEqualDiff(sio.getvalue(), """\
@@ -498,7 +500,7 @@
wt.commit('rev-2', rev_id='rev-2b',
timestamp=1132586800, timezone=36000,
committer='Joe Foo <joe at foo.com>')
- logfile = StringIO()
+ logfile = self.make_utf8_encoded_stringio()
formatter = ShortLogFormatter(to_file=logfile)
show_log(wt.branch, formatter)
logfile.flush()
@@ -516,7 +518,7 @@
def test_trailing_newlines(self):
wt = self.make_branch_and_tree('.')
b = make_commits_with_trailing_newlines(wt)
- sio = StringIO()
+ sio = self.make_utf8_encoded_stringio()
lf = LineLogFormatter(to_file=sio)
show_log(b, lf)
self.assertEqualDiff(sio.getvalue(), """\
@@ -785,7 +787,7 @@
self.build_tree(['tree_a/foo'])
tree.add('foo')
tree.commit('bar', rev_id='bar-id')
- s = StringIO()
+ s = self.make_utf8_encoded_stringio()
log.show_changed_revisions(tree.branch, [], ['bar-id'], s)
self.assertContainsRe(s.getvalue(), 'bar')
self.assertNotContainsRe(s.getvalue(), 'foo')
More information about the bazaar-commits
mailing list