Merge lp:~gz/bzr-builddeb/trivial_tweak_utf8_changelog_test into lp:bzr-builddeb

Proposed by Martin Packman
Status: Superseded
Proposed branch: lp:~gz/bzr-builddeb/trivial_tweak_utf8_changelog_test
Merge into: lp:bzr-builddeb
Diff against target: 14 lines (+2/-2)
1 file modified
tests/blackbox/test_builddeb.py (+2/-2)
To merge this branch: bzr merge lp:~gz/bzr-builddeb/trivial_tweak_utf8_changelog_test
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+79142@code.launchpad.net

This proposal has been superseded by a proposal from 2011-10-12.

Description of the change

Should fix a test failure seen on some builders from the blackbox test added for bug 853664, though I can't reproduce that problem locally. Simply changes the strings passed to debian.changelog module from unicode to pre-encoded utf-8 which, given the following traceback, should work:

Traceback (most recent call last):
  File "/build/buildd/bzr-builddeb-2.7.9+bzr629~natty1/tests/blackbox/test_builddeb.py", line 189, in test_utf8_changelog
    self.write_changelog(c, "debian/changelog")
  File "/build/buildd/bzr-builddeb-2.7.9+bzr629~natty1/tests/__init__.py", line 216, in write_changelog
    changelog.write_to_open_file(f)
  File "/usr/lib/pymodules/python2.7/debian/changelog.py", line 472, in write_to_open_file
    file.write(self.__str__())
  File "/usr/lib/pymodules/python2.7/debian/changelog.py", line 437, in __str__
    cl += str(block)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 57: ordinal not in range(128)

Confusingly I have python-debian 0.1.18 and the natty builder has 0.1.18ubuntu2 so there must be some other factor involved.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

<jelmer_> mgz: still there
<jelmer_> mgz: ?
<jelmer_> mgz: With your patch, that test fails for me on oneiric
<jelmer_> mgz: I wonder if we should just open('debian/changelog', 'w').write("""...""") to make things simpler

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

======================================================================
ERROR: bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog
----------------------------------------------------------------------
_StringException: log: {{{
3.585 creating repository in file:///tmp/testbzr-p9_cJ_.tmp/bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog/work/.bzr/.
3.588 creating branch <bzrlib.branch.BzrBranchFormat7 object at 0x3d83790> in file:///tmp/testbzr-p9_cJ_.tmp/bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog/work/
3.597 trying to create missing lock '/tmp/testbzr-p9_cJ_.tmp/bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog/work/.bzr/checkout/dirstate'
3.598 opening working tree '/tmp/testbzr-p9_cJ_.tmp/bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog/work'
3.610 preparing to commit
    INFO Committing to: /tmp/testbzr-p9_cJ_.tmp/bzrlib.plugins.builddeb.tests.blackbox.test_builddeb.TestBuilddeb.test_utf8_changelog/work/
3.613 Selecting files for commit with filter None
    INFO added README
    INFO added debian
    INFO added debian/changelog
    INFO Committed revision 1.
3.624 Committed revid prerel as revno 1.
}}}

Traceback (most recent call last):
  File "/home/jelmer/src/bzr-builddeb/trunk/tests/blackbox/test_builddeb.py", line 189, in test_utf8_changelog
    self.write_changelog(c, "debian/changelog")
  File "/home/jelmer/src/bzr-builddeb/trunk/tests/__init__.py", line 216, in write_changelog
    changelog.write_to_open_file(f)
  File "/usr/lib/python2.7/dist-packages/debian/changelog.py", line 505, in write_to_open_file
    file.write(self.__str__())
  File "/usr/lib/python2.7/dist-packages/debian/changelog.py", line 470, in __str__
    return unicode(self).encode(self._encoding)
  File "/usr/lib/python2.7/dist-packages/debian/changelog.py", line 466, in __unicode__
    pieces.append(unicode(block))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 57: ordinal not in range(128)

----------------------------------------------------------------------

Revision history for this message
Martin Packman (gz) wrote :

Thanks for testing that Jelmer. Annoying, by fiddling across different versions debian.changelog can't reliably be used with non-ascii contents. I'll look at just splatting some bytes as you suggest.

633. By Martin Packman

Give up on using debian.changelog to make something realistic and just splat something changeloggy

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/blackbox/test_builddeb.py'
2--- tests/blackbox/test_builddeb.py 2011-10-01 20:41:14 +0000
3+++ tests/blackbox/test_builddeb.py 2011-10-12 15:34:32 +0000
4@@ -184,8 +184,8 @@
5 open("debian/changelog", "w").close()
6 tree.commit("Prepare for release", rev_id="prerel")
7 c = self.make_changelog()
8- c.add_change(u"")
9- c.add_change(u" * \u2026and another thing")
10+ c.add_change("")
11+ c.add_change(" * \xe2\x80\xa6and another thing")
12 self.write_changelog(c, "debian/changelog")
13 self.run_bzr(['commit'])
14 branch = tree.branch

Subscribers

People subscribed via source and target branches