~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_version.py

  • Committer: Vincent Ladeuil
  • Date: 2016-01-21 17:48:07 UTC
  • mto: This revision was merged to the branch mainline in revision 6613.
  • Revision ID: v.ladeuil+lp@free.fr-20160121174807-g4ybpaij9ln5wj6a
Make all transport put_bytes() raises TypeError when given unicode strings rather than bytes.

There was a mix of AssertionError or UnicodeEncodeError.

Also deleted test_put_file_unicode() which was bogus, files contain bytes not unicode strings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
        self.assertTrue(len(out) > 0)
130
130
        self.assertContainsRe(out, r"(?m)^  Bazaar log file: " + bzr_log)
131
131
        self.assertPathDoesNotExist(default_log)
 
132
 
 
133
    def test_unicode_bzr_log(self):
 
134
        uni_val = u"\xa7"
 
135
        enc = osutils.get_user_encoding()
 
136
        try:
 
137
            str_val = uni_val.encode(enc)
 
138
        except UnicodeEncodeError:
 
139
            self.skip("Test string %r unrepresentable in user encoding %s" % (
 
140
                uni_val, enc))
 
141
        self.overrideEnv('BZR_HOME', self.test_base_dir)
 
142
        self.overrideEnv("BZR_LOG",
 
143
            os.path.join(self.test_base_dir, uni_val).encode(enc))
 
144
        out, err = self.run_bzr_subprocess("version")
 
145
        uni_out = out.decode(enc)
 
146
        self.assertContainsRe(uni_out, u"(?m)^  Bazaar log file: .*/\xa7$")
 
147
 
 
148