~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        pathjoin,
36
36
        )
37
37
from bzrlib.tests import (
 
38
        probe_unicode_in_user_encoding,
38
39
        StringIOWrapper,
39
40
        TestCase,
40
41
        TestCaseInTempDir,
476
477
        #       osutils.getcwd() renormalize the path.
477
478
        self.assertEndsWith(osutils._win32_getcwd(), u'mu-\xb5')
478
479
 
 
480
    def test_minimum_path_selection(self):
 
481
        self.assertEqual(set(),
 
482
            osutils.minimum_path_selection([]))
 
483
        self.assertEqual(set(['a', 'b']),
 
484
            osutils.minimum_path_selection(['a', 'b']))
 
485
        self.assertEqual(set(['a/', 'b']),
 
486
            osutils.minimum_path_selection(['a/', 'b']))
 
487
        self.assertEqual(set(['a/', 'b']),
 
488
            osutils.minimum_path_selection(['a/c', 'a/', 'b']))
 
489
 
479
490
    def test_mkdtemp(self):
480
491
        tmpdir = osutils._win32_mkdtemp(dir='.')
481
492
        self.assertFalse('\\' in tmpdir)
1001
1012
        
1002
1013
        So Unicode strings must be encoded.
1003
1014
        """
1004
 
        # Try a few different characters, to see if we can get
1005
 
        # one that will be valid in the user_encoding
1006
 
        possible_vals = [u'm\xb5', u'\xe1', u'\u0410']
1007
 
        for uni_val in possible_vals:
1008
 
            try:
1009
 
                env_val = uni_val.encode(bzrlib.user_encoding)
1010
 
            except UnicodeEncodeError:
1011
 
                # Try a different character
1012
 
                pass
1013
 
            else:
1014
 
                break
1015
 
        else:
 
1015
        uni_val, env_val = probe_unicode_in_user_encoding()
 
1016
        if uni_val is None:
1016
1017
            raise TestSkipped('Cannot find a unicode character that works in'
1017
1018
                              ' encoding %s' % (bzrlib.user_encoding,))
1018
1019