/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: 2019-03-04 05:10:44 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20190304051044-vph4s8p9qvpy2qe9
Merge trunk.

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,
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
 
50
72
    def test_log_C(self):
51
73
        self.disable_missing_extensions_warning()
52
74
        out, err = self.run_log_quiet_long(
54
76
            # C is not necessarily the default locale, so set both LANG and
55
77
            # LC_ALL explicitly because LC_ALL is preferred on (some?) Linux
56
78
            # systems but only LANG is respected on Windows.
57
 
            env_changes={'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE': None,
58
 
                         'LANGUAGE': None})
 
79
            env_changes={
 
80
                'LANG': 'C', 'LC_ALL': 'C', 'LC_CTYPE': None,
 
81
                'LANGUAGE': None, 'PYTHONCOERCECLOCALE': '0', 'PYTHONUTF8': '0'})
59
82
        self.assertEqual(b'', err)
60
83
        self.assertEqualDiff(b"""\
61
84
------------------------------------------------------------
71
94
        out, err = self.run_log_quiet_long(
72
95
            ['tree'],
73
96
            env_changes={'LANG': 'BOGUS', 'LC_ALL': None, 'LC_CTYPE': None,
74
 
                         'LANGUAGE': None})
 
97
                         'LANGUAGE': None, 'PYTHONCOERCECLOCALE': '0',
 
98
                         'PYTHONUTF8': '0'})
75
99
        self.assertStartsWith(err, b'brz: warning: unsupported locale setting')
76
100
        self.assertEqualDiff(b"""\
77
101
------------------------------------------------------------