~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__walkdirs_win32.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:
22
22
    osutils,
23
23
    tests,
24
24
    )
25
 
 
26
 
 
27
 
win32_readdir_feature = tests.ModuleAvailableFeature('bzrlib._walkdirs_win32')
 
25
from bzrlib.tests import (
 
26
    features,
 
27
    )
 
28
 
 
29
 
 
30
win32_readdir_feature = features.ModuleAvailableFeature('bzrlib._walkdirs_win32')
28
31
 
29
32
 
30
33
class TestWin32Finder(tests.TestCaseInTempDir):
93
96
        self.assertEqual(errno.ENOENT, e.errno)
94
97
        self.assertEqual(3, e.winerror)
95
98
        self.assertEqual((3, u'no_such_dir/*'), e.args)
 
99
 
 
100
 
 
101
class Test_Win32Stat(tests.TestCaseInTempDir):
 
102
 
 
103
    _test_needs_features = [win32_readdir_feature]
 
104
 
 
105
    def setUp(self):
 
106
        super(Test_Win32Stat, self).setUp()
 
107
        from bzrlib._walkdirs_win32 import lstat
 
108
        self.win32_lstat = lstat
 
109
 
 
110
    def test_zero_members_present(self):
 
111
        self.build_tree(['foo'])
 
112
        st = self.win32_lstat('foo')
 
113
        # we only want to ensure that some members are present
 
114
        self.assertEqual(0, st.st_dev)
 
115
        self.assertEqual(0, st.st_ino)
 
116
        self.assertEqual(0, st.st_uid)
 
117
        self.assertEqual(0, st.st_gid)