Merge lp:~jelmer/brz/3.0-encoding into lp:brz/3.0

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/3.0-encoding
Merge into: lp:brz/3.0
Diff against target: 57 lines (+14/-11)
2 files modified
breezy/tests/blackbox/test_testament.py (+10/-11)
doc/en/release-notes/brz-3.0.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/brz/3.0-encoding
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+374753@code.launchpad.net

Commit message

Fix bb.test_testament.TestTestament.test_testament_non_ascii on systems where the host encoding is ascii.

Description of the change

Fix bb.test_testament.TestTestament.test_testament_non_ascii on systems where the host encoding is ascii.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/blackbox/test_testament.py'
2--- breezy/tests/blackbox/test_testament.py 2018-11-11 04:08:32 +0000
3+++ breezy/tests/blackbox/test_testament.py 2019-10-27 01:00:11 +0000
4@@ -35,28 +35,27 @@
5 """Testament containing a file and a directory."""
6 out, err = self.run_bzr('testament --long')
7 self.assertEqualDiff(err, '')
8- self.assertEqualDiff(out, REV_2_TESTAMENT.decode('utf-8'))
9+ self.assertEqualDiff(out, REV_2_TESTAMENT.decode('ascii'))
10
11 def test_testament_command_2(self):
12 """Command getting short testament of previous version."""
13 out, err = self.run_bzr('testament -r1')
14 self.assertEqualDiff(err, '')
15- self.assertEqualDiff(out, REV_1_SHORT.decode('utf-8'))
16+ self.assertEqualDiff(out, REV_1_SHORT.decode('ascii'))
17
18 def test_testament_command_3(self):
19 """Command getting short testament of previous version."""
20 out, err = self.run_bzr('testament -r1 --strict')
21 self.assertEqualDiff(err, '')
22- self.assertEqualDiff(out, REV_1_SHORT_STRICT.decode('utf-8'))
23+ self.assertEqualDiff(out, REV_1_SHORT_STRICT.decode('ascii'))
24
25 def test_testament_non_ascii(self):
26 self.wt.commit(u"Non \xe5ssci message")
27- long_out, err = self.run_bzr('testament --long')
28- self.assertEqualDiff(err, '')
29- short_out, err = self.run_bzr('testament')
30- self.assertEqualDiff(err, '')
31- sha1_re = re.compile('sha1: (?P<sha1>[a-f0-9]+)$', re.M)
32+ long_out, err = self.run_bzr_raw('testament --long', encoding='utf-8')
33+ self.assertEqualDiff(err, b'')
34+ long_out, err = self.run_bzr_raw('testament --long', encoding='ascii')
35+ short_out, err = self.run_bzr_raw('testament', encoding='ascii')
36+ self.assertEqualDiff(err, b'')
37+ sha1_re = re.compile(b'sha1: (?P<sha1>[a-f0-9]+)$', re.M)
38 sha1 = sha1_re.search(short_out).group('sha1')
39- self.assertEqual(
40- sha1.encode('ascii'),
41- osutils.sha_string(long_out.encode('utf-8') if PY3 else long_out))
42+ self.assertEqual(sha1, osutils.sha_string(long_out))
43
44=== modified file 'doc/en/release-notes/brz-3.0.txt'
45--- doc/en/release-notes/brz-3.0.txt 2019-10-13 16:48:38 +0000
46+++ doc/en/release-notes/brz-3.0.txt 2019-10-27 01:00:11 +0000
47@@ -60,6 +60,10 @@
48 suite. This can include new facilities for writing tests, fixes to
49 spurious test failures and changes to the way things should be tested.
50
51+ * Fix bb.test_testament.TestTestament.test_testament_non_ascii
52+ when the host encoding is non-utf8.
53+ (Jelmer Vernooij, #1849986)
54+
55
56 bzr 3.0.1
57 #########

Subscribers

People subscribed via source and target branches