~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testnonascii.py

- rules for using destructors

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib.osutils import pathjoin
22
 
from bzrlib.tests import TestCaseWithTransport, TestSkipped
23
 
from bzrlib.workingtree import WorkingTree
24
 
 
25
 
 
26
 
class NonAsciiTest(TestCaseWithTransport):
 
21
from bzrlib.selftest import TestCaseInTempDir
 
22
from bzrlib.branch import Branch
 
23
 
 
24
 
 
25
class NonAsciiTest(TestCaseInTempDir):
27
26
 
28
27
    def test_add_in_nonascii_branch(self):
29
28
        """Test adding in a non-ASCII branch."""
30
29
        br_dir = u"\u1234"
31
30
        try:
32
 
            wt = self.make_branch_and_tree(br_dir)
33
 
        except UnicodeEncodeError:
34
 
            raise TestSkipped("filesystem can't accomodate nonascii names")
 
31
            os.mkdir(br_dir)
 
32
            os.chdir(br_dir)
 
33
        except EncodingError:
 
34
            self.log("filesystem can't accomodate nonascii names")
35
35
            return
36
 
        file(pathjoin(br_dir, "a"), "w").write("hello")
37
 
        wt.add(["a"], ["a-id"])
 
36
        br = Branch.initialize(u".")
 
37
        file("a", "w").write("hello")
 
38
        br.add(["a"], ["a-id"])