Merge lp:~cjwatson/difftacular/py3 into lp:difftacular

Proposed by Colin Watson on 2019-06-14
Status: Merged
Merged at revision: 11
Proposed branch: lp:~cjwatson/difftacular/py3
Merge into: lp:difftacular
Diff against target: 68 lines (+18/-18)
1 file modified
tests/test_generate_diff.py (+18/-18)
To merge this branch: bzr merge lp:~cjwatson/difftacular/py3
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve on 2019-06-14
Canonical Launchpad Engineering 2019-06-14 Pending
Review via email: mp+368822@code.launchpad.net

Commit message

Port to Python 3.

To post a comment you must log in.
Jelmer Vernooij (jelmer) wrote :

Looks Good To Me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_generate_diff.py'
2--- tests/test_generate_diff.py 2019-06-14 09:29:25 +0000
3+++ tests/test_generate_diff.py 2019-06-14 10:06:42 +0000
4@@ -15,7 +15,7 @@
5 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
7
8-from StringIO import StringIO
9+from io import BytesIO
10
11 from .. import generate_diff
12 from .... import tests
13@@ -50,11 +50,11 @@
14
15 def test_mainline_diff(self):
16 foo, bar, rev1, rev2, rev2_bar, rev3 = self.create_diff_scenario()
17- s = StringIO()
18- generate_diff.mainline_diff(foo.branch, rev1, rev3, s)
19- self.assertContainsRe(s.getvalue(), '\+b')
20- self.assertContainsRe(s.getvalue(), ' a')
21- self.assertNotContainsRe(s.getvalue(), '\+c')
22+ buf = BytesIO()
23+ generate_diff.mainline_diff(foo.branch, rev1, rev3, buf)
24+ self.assertContainsRe(buf.getvalue(), br'\+b')
25+ self.assertContainsRe(buf.getvalue(), br' a')
26+ self.assertNotContainsRe(buf.getvalue(), br'\+c')
27
28 def test_merges(self):
29 foo, bar, rev1, rev2, rev2_bar, rev3 = self.create_diff_scenario()
30@@ -72,26 +72,26 @@
31
32 def test_diff_ignore_branches(self):
33 foo, bar, rev1, rev2_bar, rev4 = self.create_unignored_merge_scenario()
34- s = StringIO()
35+ buf = BytesIO()
36 generate_diff.diff_ignore_branches(foo.branch, [bar.branch], rev1,
37- rev4, s)
38- self.assertContainsRe(s.getvalue(), '\+b')
39- self.assertContainsRe(s.getvalue(), ' a')
40- self.assertNotContainsRe(s.getvalue(), '\+c')
41- self.assertContainsRe(s.getvalue(), '\+d')
42+ rev4, buf)
43+ self.assertContainsRe(buf.getvalue(), br'\+b')
44+ self.assertContainsRe(buf.getvalue(), br' a')
45+ self.assertNotContainsRe(buf.getvalue(), br'\+c')
46+ self.assertContainsRe(buf.getvalue(), br'\+d')
47
48 def test_diff_ignore_old_revisions(self):
49 foo, bar, rev1, rev2_bar, rev4 = self.create_unignored_merge_scenario()
50 bar.commit('emtpy commit')
51 foo.merge_from_branch(bar.branch)
52 rev5 = foo.commit('empty commit')
53- s = StringIO()
54+ buf = BytesIO()
55 generate_diff.diff_ignore_branches(foo.branch, [bar.branch], rev1,
56- rev5, s)
57- self.assertContainsRe(s.getvalue(), '\+b')
58- self.assertContainsRe(s.getvalue(), ' a')
59- self.assertNotContainsRe(s.getvalue(), '\+c')
60- self.assertContainsRe(s.getvalue(), '\+d')
61+ rev5, buf)
62+ self.assertContainsRe(buf.getvalue(), br'\+b')
63+ self.assertContainsRe(buf.getvalue(), br' a')
64+ self.assertNotContainsRe(buf.getvalue(), br'\+c')
65+ self.assertContainsRe(buf.getvalue(), br'\+d')
66
67 def test_ignore_heads(self):
68 foo, bar, rev1, rev2_bar, rev4 = self.create_unignored_merge_scenario()

Subscribers

People subscribed via source and target branches

to all changes: