~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_win32utils.py

  • Committer: Robert Collins
  • Date: 2010-05-20 02:57:52 UTC
  • mfrom: (4797.43.11 2.1)
  • mto: This revision was merged to the branch mainline in revision 5243.
  • Revision ID: robertc@robertcollins.net-20100520025752-dbfi4kx7y4ivtiff
Merge up from 2.0/2.1:

* Support Pyrex 0.9.9, required changing how we handle exceptions in Pyrex.
  (John Arbash Meinel, #582656)

* ``bzr clean-tree`` should not delete nested bzrdirs. Required for proper
  support of bzr-externals and scmproj plugins.
  (Alexander Belchenko, bug #572098)

* Reduce peak memory by one copy of compressed text.
  (John Arbash Meinel, #566940)

* Support Pyrex 0.9.9, required changing how we handle exceptions in Pyrex.
  (John Arbash Meinel, #582656)

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
 
17
19
import os
18
20
import sys
19
21
 
29
31
    TestSkipped,
30
32
    UnicodeFilenameFeature,
31
33
    )
 
34
from bzrlib.tests.features import backslashdir_feature
32
35
from bzrlib.win32utils import glob_expand, get_app_path
33
36
 
34
37
 
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
 
 
51
38
class _RequiredModuleFeature(Feature):
52
39
 
53
40
    def __init__(self, mod_name):
121
108
            ])
122
109
 
123
110
    def test_backslash_globbing(self):
124
 
        self.requireFeature(BackslashDirSeparatorFeature)
 
111
        self.requireFeature(backslashdir_feature)
125
112
        self.build_ascii_tree()
126
113
        self._run_testset([
127
114
            [[u'd\\'], [u'd/']],
164
151
            ])
165
152
 
166
153
    def test_unicode_backslashes(self):
167
 
        self.requireFeature(BackslashDirSeparatorFeature)
 
154
        self.requireFeature(backslashdir_feature)
168
155
        self.build_unicode_tree()
169
156
        self._run_testset([
170
157
            # no wildcards
287
274
        win32utils.set_file_attr_hidden(path)
288
275
 
289
276
 
290
 
 
291
 
 
292
277
class Test_CommandLineToArgv(tests.TestCaseInTempDir):
293
278
 
294
279
    def assertCommandLine(self, expected, line, single_quotes_allowed=False):
338
323
        self.assertCommandLine([u'A/b.c'], 'A/B*')
339
324
 
340
325
    def test_backslashes(self):
341
 
        self.requireFeature(BackslashDirSeparatorFeature)
 
326
        self.requireFeature(backslashdir_feature)
342
327
        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
343
328
        self.assertCommandLine([u'a/b.c'], 'a\\b*')