Merge lp:~jelmer/brz/3.8-compat 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.8-compat
Merge into: lp:brz/3.0
Diff against target: 75 lines (+16/-6)
3 files modified
breezy/export_pot.py (+2/-1)
breezy/tests/blackbox/test_locale.py (+6/-0)
breezy/tests/test_export_pot.py (+8/-5)
To merge this branch: bzr merge lp:~jelmer/brz/3.8-compat
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+378691@code.launchpad.net

Commit message

More improvements to make tests success with Python 3.8.

Description of the change

More improvements to make tests success with Python 3.8.

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/export_pot.py'
2--- breezy/export_pot.py 2018-11-11 04:08:32 +0000
3+++ breezy/export_pot.py 2020-02-07 01:05:29 +0000
4@@ -30,6 +30,7 @@
5
6 import inspect
7 import os
8+import sys
9
10 import breezy
11 from . import (
12@@ -87,7 +88,7 @@
13 # string terminates on. It's more useful to have the line the
14 # string begins on. Unfortunately, counting back newlines is
15 # only an approximation as the AST is ignorant of escaping.
16- str_to_lineno[node.s] = node.lineno - node.s.count('\n')
17+ str_to_lineno[node.s] = node.lineno - (0 if sys.version_info >= (3, 8) else node.s.count('\n'))
18 return cls_to_lineno, str_to_lineno
19
20
21
22=== modified file 'breezy/tests/blackbox/test_locale.py'
23--- breezy/tests/blackbox/test_locale.py 2018-11-22 02:01:59 +0000
24+++ breezy/tests/blackbox/test_locale.py 2020-02-07 01:05:29 +0000
25@@ -69,6 +69,9 @@
26 Unicode \xc2\xb5 commit
27 """, out)
28
29+ @unittest.skipIf(
30+ sys.version_info[:2] >= (3, 8),
31+ "python > 3.8 doesn't allow changing filesystem default encoding")
32 def test_log_C(self):
33 self.disable_missing_extensions_warning()
34 out, err = self.run_log_quiet_long(
35@@ -90,6 +93,9 @@
36 Unicode ? commit
37 """, out)
38
39+ @unittest.skipIf(
40+ sys.version_info[:2] >= (3, 8),
41+ "python > 3.8 doesn't allow changing filesystem default encoding")
42 def test_log_BOGUS(self):
43 out, err = self.run_log_quiet_long(
44 ['tree'],
45
46=== modified file 'breezy/tests/test_export_pot.py'
47--- breezy/tests/test_export_pot.py 2018-11-11 04:08:32 +0000
48+++ breezy/tests/test_export_pot.py 2020-02-07 01:05:29 +0000
49@@ -15,6 +15,7 @@
50 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
51
52 import re
53+import sys
54 import textwrap
55
56 from io import StringIO
57@@ -149,11 +150,13 @@
58 )
59 '''
60 _, str_lines = export_pot._parse_source(src)
61- self.expectFailure("Escaped newlines confuses the multiline handling",
62- self.assertNotEqual, str_lines,
63- {"Escaped\n": 0, "Raw\\n": 2, "A\n\nB\n\nC\n\n": -2})
64- self.assertEqual(str_lines,
65- {"Escaped\n": 1, "Raw\\n": 2, "A\n\nB\n\nC\n\n": 4})
66+ if sys.version_info < (3, 8):
67+ self.expectFailure("Escaped newlines confuses the multiline handling",
68+ self.assertNotEqual, str_lines,
69+ {"Escaped\n": 0, "Raw\\n": 2, "A\n\nB\n\nC\n\n": -2})
70+ else:
71+ self.assertEqual(
72+ str_lines, {"Escaped\n": 1, "Raw\\n": 2, "A\n\nB\n\nC\n\n": 4})
73
74
75 class TestModuleContext(tests.TestCase):

Subscribers

People subscribed via source and target branches