Merge lp:~gz/brz/test_details_utf8_bytes into lp:brz

Proposed by Martin Packman
Status: Merged
Approved by: Martin Packman
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~gz/brz/test_details_utf8_bytes
Merge into: lp:brz
Diff against target: 23 lines (+3/-3)
1 file modified
breezy/tests/__init__.py (+3/-3)
To merge this branch: bzr merge lp:~gz/brz/test_details_utf8_bytes
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+326644@code.launchpad.net

Commit message

Fix selftest error on Python 3 when benchmarks are used

Description of the change

We need to give testtools bytes for details, branch makes float/int values wrapped up correctly for Python 3.

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/__init__.py'
2--- breezy/tests/__init__.py 2017-06-15 23:45:30 +0000
3+++ breezy/tests/__init__.py 2017-07-02 13:47:27 +0000
4@@ -1033,7 +1033,7 @@
5 % (counter_name,))
6 _counters[counter_name] = 0
7 self.addDetail(counter_name, content.Content(content.UTF8_TEXT,
8- lambda: ['%d' % (_counters[counter_name],)]))
9+ lambda: [b'%d' % (_counters[counter_name],)]))
10 def increment_counter(*args, **kwargs):
11 _counters[counter_name] += 1
12 label = 'count %s calls' % (counter_name,)
13@@ -1880,8 +1880,8 @@
14 self._benchcalls.
15 """
16 if self._benchtime is None:
17- self.addDetail('benchtime', content.Content(content.ContentType(
18- "text", "plain"), lambda:[str(self._benchtime)]))
19+ self.addDetail('benchtime', content.Content(content.UTF8_TEXT,
20+ lambda:[str(self._benchtime).encode('utf-8')]))
21 self._benchtime = 0
22 start = time.time()
23 try:

Subscribers

People subscribed via source and target branches