~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_win32utils.py

  • Committer: Martin Pool
  • Date: 2009-07-17 10:38:41 UTC
  • mfrom: (4536 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4558.
  • Revision ID: mbp@sourcefrog.net-20090717103841-z35onk04bkiw7zb6
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import sys
19
19
 
20
20
from bzrlib import osutils
21
 
from bzrlib.tests import TestCase, TestCaseInTempDir, TestSkipped, Feature
 
21
from bzrlib.tests import (
 
22
    Feature,
 
23
    TestCase,
 
24
    TestCaseInTempDir,
 
25
    TestSkipped,
 
26
    UnicodeFilenameFeature,
 
27
    )
22
28
from bzrlib.win32utils import glob_expand, get_app_path
23
29
from bzrlib import win32utils
24
30
 
164
170
            self.assertEquals('iexplore.exe', b.lower())
165
171
            self.assertNotEquals('', d)
166
172
 
 
173
    def test_wordpad(self):
 
174
        # typical windows users should have wordpad in the system
 
175
        # but there is problem: its path has the format REG_EXPAND_SZ
 
176
        # so naive attempt to get the path is not working
 
177
        for a in ('wordpad', 'wordpad.exe'):
 
178
            p = get_app_path(a)
 
179
            d, b = os.path.split(p)
 
180
            self.assertEquals('wordpad.exe', b.lower())
 
181
            self.assertNotEquals('', d)
 
182
 
167
183
    def test_not_existing(self):
168
184
        p = get_app_path('not-existing')
169
185
        self.assertEquals('not-existing', p)
228
244
 
229
245
    def restoreCtypes(self):
230
246
        win32utils.has_ctypes = self.old_ctypes
 
247
 
 
248
 
 
249
class TestSetHidden(TestCaseInTempDir):
 
250
 
 
251
    def test_unicode_dir(self):
 
252
        # we should handle unicode paths without errors
 
253
        self.requireFeature(UnicodeFilenameFeature)
 
254
        os.mkdir(u'\u1234')
 
255
        win32utils.set_file_attr_hidden(u'\u1234')
 
256
 
 
257
    def test_dot_bzr_in_unicode_dir(self):
 
258
        # we should not raise traceback if we try to set hidden attribute
 
259
        # on .bzr directory below unicode path
 
260
        self.requireFeature(UnicodeFilenameFeature)
 
261
        os.makedirs(u'\u1234\\.bzr')
 
262
        path = osutils.abspath(u'\u1234\\.bzr')
 
263
        win32utils.set_file_attr_hidden(path)