/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/test_nonascii.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 07:18:33 UTC
  • mfrom: (7141.3.3 fix1799482)
  • Revision ID: breezy.the.bot@gmail.com-20181116071833-e01b0833f3hkc3et
Report correct paths when running "brz add" in git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/fix1799482/+merge/357734

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2009, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
20
20
import sys
21
21
from unicodedata import normalize
22
22
 
23
 
from bzrlib import osutils
24
 
from bzrlib.osutils import pathjoin
25
 
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
26
 
from bzrlib.workingtree import WorkingTree
 
23
from .. import osutils
 
24
from ..osutils import pathjoin
 
25
from . import TestCase, TestCaseWithTransport, TestSkipped
27
26
 
28
27
 
29
28
class NonAsciiTest(TestCaseWithTransport):
36
35
        except UnicodeEncodeError:
37
36
            raise TestSkipped("filesystem can't accomodate nonascii names")
38
37
            return
39
 
        file(pathjoin(br_dir, "a"), "w").write("hello")
40
 
        wt.add(["a"], ["a-id"])
 
38
        with open(pathjoin(br_dir, "a"), "w") as f: f.write("hello")
 
39
        wt.add(["a"], [b"a-id"])
41
40
 
42
41
 
43
42
a_circle_c = u'\xe5'
152
151
            self.assertEqual(path, fname)
153
152
            self.assertTrue(can_access)
154
153
 
155
 
            f = open(path, 'rb')
156
 
            try:
 
154
            with open(path, 'rb') as f:
157
155
                # Check the contents
158
 
                shouldbe = 'contents of %s%s' % (path.encode('utf8'),
159
 
                                                 os.linesep)
 
156
                shouldbe = b'contents of %s%s' % (path.encode('utf8'),
 
157
                                                  os.linesep.encode('utf-8'))
160
158
                actual = f.read()
161
 
            finally:
162
 
                f.close()
163
159
            self.assertEqual(shouldbe, actual,
164
160
                             'contents of %r is incorrect: %r != %r'
165
161
                             % (path, shouldbe, actual))