~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-18 16:08:27 UTC
  • mfrom: (4789.25.7 2.1.0b4-win32-minor)
  • mto: This revision was merged to the branch mainline in revision 4810.
  • Revision ID: john@arbash-meinel.com-20091118160827-39riegxus1zihosi
merge the 'minor' changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    return s
59
59
 
60
60
 
61
 
def _fs_enc_to_unicode(s):
62
 
    return s.decode(osutils._fs_enc)
63
 
 
64
 
 
65
61
def _utf8_to_unicode(s):
66
62
    return s.decode('UTF-8')
67
63
 
87
83
    if test__walkdirs_win32.Win32ReadDirFeature.available():
88
84
        try:
89
85
            from bzrlib import _walkdirs_win32
90
 
            # TODO: check on windows, it may be that we need to use/add
91
 
            # safe_unicode instead of _fs_enc_to_unicode
92
86
            scenarios.append(
93
87
                ('win32',
94
88
                 dict(_dir_reader_class=_walkdirs_win32.Win32ReadDir,
95
 
                      _native_to_unicode=_fs_enc_to_unicode)))
 
89
                      _native_to_unicode=_already_unicode)))
96
90
        except ImportError:
97
91
            pass
98
92
    return scenarios
1631
1625
        text = 'test\r\nwith\nall\rpossible line endings\r\n'
1632
1626
        self.build_tree_contents([('foo', text)])
1633
1627
        expected_sha = osutils.sha_string(text)
1634
 
        f = open('foo')
 
1628
        f = open('foo', 'rb')
1635
1629
        self.addCleanup(f.close)
1636
1630
        size, sha = osutils.size_sha_file(f)
1637
1631
        self.assertEqual(38, size)