/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_locale.py

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 01:35:14 UTC
  • mfrom: (7490.7.6 work)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: jelmer@jelmer.uk-20200322013514-7vw1ntwho04rcuj3
merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Test that brz handles locales in a reasonable way"""
18
18
 
19
19
import sys
 
20
import unittest
20
21
 
21
22
from breezy import (
22
23
    tests,
35
36
        tree = self.make_branch_and_tree('tree')
36
37
        self.build_tree(['tree/a'])
37
38
        tree.add('a')
38
 
        tree.commit(u'Unicode \xb5 commit', rev_id='r1',
 
39
        tree.commit(u'Unicode \xb5 commit', rev_id=b'r1',
39
40
                    committer=u'\u062c\u0648\u062c\u0648'
40
41
                              u' Meinel <juju@info.com>',
41
42
                    timestamp=1156451297.96, timezone=0)
47
48
        cmd.extend(args)
48
49
        return self.run_bzr_subprocess(cmd, env_changes=env_changes)
49
50
 
 
51
    @unittest.skipIf(sys.version_info[:2] < (3, 7), "python < 3.7 doesn't coerce utf-8")
 
52
    def test_log_coerced_utf8(self):
 
53
        self.disable_missing_extensions_warning()
 
54
        out, err = self.run_log_quiet_long(
 
55
            ['tree'],
 
56
            # C is not necessarily the default locale, so set both LANG and
 
57
            # LC_ALL explicitly because LC_ALL is preferred on (some?) Linux
 
58
            # systems but only LANG is respected on Windows.
 
59
            env_changes={
 
60
                'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE': None, 'LANGUAGE': None})
 
61
        self.assertEqual(b'', err)
 
62
        self.assertEqualDiff(b"""\
 
63
------------------------------------------------------------
 
64
revno: 1
 
65
committer: \xd8\xac\xd9\x88\xd8\xac\xd9\x88 Meinel <juju@info.com>
 
66
branch nick: tree
 
67
timestamp: Thu 2006-08-24 20:28:17 +0000
 
68
message:
 
69
  Unicode \xc2\xb5 commit
 
70
""", out)
 
71
 
 
72
    @unittest.skipIf(
 
73
        sys.version_info[:2] >= (3, 8),
 
74
        "python > 3.8 doesn't allow changing filesystem default encoding")
50
75
    def test_log_C(self):
51
76
        self.disable_missing_extensions_warning()
52
77
        out, err = self.run_log_quiet_long(
54
79
            # C is not necessarily the default locale, so set both LANG and
55
80
            # LC_ALL explicitly because LC_ALL is preferred on (some?) Linux
56
81
            # systems but only LANG is respected on Windows.
57
 
            env_changes={'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE':None,
58
 
                         'LANGUAGE':None})
59
 
        self.assertEqual('', err)
60
 
        self.assertEqualDiff("""\
 
82
            env_changes={
 
83
                'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE': None,
 
84
                'LANGUAGE': None, 'PYTHONCOERCECLOCALE': '0', 'PYTHONUTF8': '0'})
 
85
        self.assertEqual(b'', err)
 
86
        self.assertEqualDiff(b"""\
61
87
------------------------------------------------------------
62
88
revno: 1
63
89
committer: ???? Meinel <juju@info.com>
67
93
  Unicode ? commit
68
94
""", out)
69
95
 
 
96
    @unittest.skipIf(
 
97
        sys.version_info[:2] >= (3, 8),
 
98
        "python > 3.8 doesn't allow changing filesystem default encoding")
70
99
    def test_log_BOGUS(self):
71
100
        out, err = self.run_log_quiet_long(
72
101
            ['tree'],
73
 
            env_changes={'LANG':'BOGUS', 'LC_ALL':None, 'LC_CTYPE':None,
74
 
                         'LANGUAGE':None})
75
 
        self.assertStartsWith(err, 'brz: warning: unsupported locale setting')
76
 
        self.assertEqualDiff("""\
 
102
            env_changes={'LANG': 'BOGUS', 'LC_ALL': None, 'LC_CTYPE': None,
 
103
                         'LANGUAGE': None, 'PYTHONCOERCECLOCALE': '0',
 
104
                         'PYTHONUTF8': '0'})
 
105
        self.assertStartsWith(err, b'brz: warning: unsupported locale setting')
 
106
        self.assertEqualDiff(b"""\
77
107
------------------------------------------------------------
78
108
revno: 1
79
109
committer: ???? Meinel <juju@info.com>