/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_win32utils.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Tests for win32utils."""
18
 
 
19
17
import os
20
18
import sys
21
19
 
31
29
    TestSkipped,
32
30
    UnicodeFilenameFeature,
33
31
    )
34
 
from bzrlib.tests.features import backslashdir_feature
35
32
from bzrlib.win32utils import glob_expand, get_app_path
36
33
 
37
34
 
 
35
class _BackslashDirSeparatorFeature(tests.Feature):
 
36
 
 
37
    def _probe(self):
 
38
        try:
 
39
            os.lstat(os.getcwd() + '\\')
 
40
        except OSError:
 
41
            return False
 
42
        else:
 
43
            return True
 
44
 
 
45
    def feature_name(self):
 
46
        return "Filesystem treats '\\' as a directory separator."
 
47
 
 
48
BackslashDirSeparatorFeature = _BackslashDirSeparatorFeature()
 
49
 
 
50
 
38
51
class _RequiredModuleFeature(Feature):
39
52
 
40
53
    def __init__(self, mod_name):
108
121
            ])
109
122
 
110
123
    def test_backslash_globbing(self):
111
 
        self.requireFeature(backslashdir_feature)
 
124
        self.requireFeature(BackslashDirSeparatorFeature)
112
125
        self.build_ascii_tree()
113
126
        self._run_testset([
114
127
            [[u'd\\'], [u'd/']],
151
164
            ])
152
165
 
153
166
    def test_unicode_backslashes(self):
154
 
        self.requireFeature(backslashdir_feature)
 
167
        self.requireFeature(BackslashDirSeparatorFeature)
155
168
        self.build_unicode_tree()
156
169
        self._run_testset([
157
170
            # no wildcards
274
287
        win32utils.set_file_attr_hidden(path)
275
288
 
276
289
 
 
290
 
 
291
 
277
292
class Test_CommandLineToArgv(tests.TestCaseInTempDir):
278
293
 
279
294
    def assertCommandLine(self, expected, line, single_quotes_allowed=False):
323
338
        self.assertCommandLine([u'A/b.c'], 'A/B*')
324
339
 
325
340
    def test_backslashes(self):
326
 
        self.requireFeature(backslashdir_feature)
 
341
        self.requireFeature(BackslashDirSeparatorFeature)
327
342
        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
328
343
        self.assertCommandLine([u'a/b.c'], 'a\\b*')