/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_osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2011-10-07 15:49:08 UTC
  • mto: (6015.33.11 2.4)
  • mto: This revision was merged to the branch mainline in revision 6206.
  • Revision ID: v.ladeuil+lp@free.fr-20111007154908-51te99s60r7hsisd
Less code, more explanations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
21
21
import os
22
22
import re
23
23
import socket
24
 
import stat
25
24
import sys
26
25
import time
27
26
 
28
27
from bzrlib import (
29
28
    errors,
 
29
    lazy_regex,
30
30
    osutils,
 
31
    symbol_versioning,
31
32
    tests,
32
33
    trace,
33
34
    win32utils,
37
38
    file_utils,
38
39
    test__walkdirs_win32,
39
40
    )
 
41
from bzrlib.tests.scenarios import load_tests_apply_scenarios
40
42
 
41
43
 
42
44
class _UTF8DirReaderFeature(tests.Feature):
95
97
    return scenarios
96
98
 
97
99
 
98
 
def load_tests(basic_tests, module, loader):
99
 
    suite = loader.suiteClass()
100
 
    dir_reader_tests, remaining_tests = tests.split_suite_by_condition(
101
 
        basic_tests, tests.condition_isinstance(TestDirReader))
102
 
    tests.multiply_tests(dir_reader_tests, dir_reader_scenarios(), suite)
103
 
    suite.addTest(remaining_tests)
104
 
    return suite
 
100
load_tests = load_tests_apply_scenarios
105
101
 
106
102
 
107
103
class TestContainsWhitespace(tests.TestCase):
108
104
 
109
105
    def test_contains_whitespace(self):
110
 
        self.failUnless(osutils.contains_whitespace(u' '))
111
 
        self.failUnless(osutils.contains_whitespace(u'hello there'))
112
 
        self.failUnless(osutils.contains_whitespace(u'hellothere\n'))
113
 
        self.failUnless(osutils.contains_whitespace(u'hello\nthere'))
114
 
        self.failUnless(osutils.contains_whitespace(u'hello\rthere'))
115
 
        self.failUnless(osutils.contains_whitespace(u'hello\tthere'))
 
106
        self.assertTrue(osutils.contains_whitespace(u' '))
 
107
        self.assertTrue(osutils.contains_whitespace(u'hello there'))
 
108
        self.assertTrue(osutils.contains_whitespace(u'hellothere\n'))
 
109
        self.assertTrue(osutils.contains_whitespace(u'hello\nthere'))
 
110
        self.assertTrue(osutils.contains_whitespace(u'hello\rthere'))
 
111
        self.assertTrue(osutils.contains_whitespace(u'hello\tthere'))
116
112
 
117
113
        # \xa0 is "Non-breaking-space" which on some python locales thinks it
118
114
        # is whitespace, but we do not.
119
 
        self.failIf(osutils.contains_whitespace(u''))
120
 
        self.failIf(osutils.contains_whitespace(u'hellothere'))
121
 
        self.failIf(osutils.contains_whitespace(u'hello\xa0there'))
 
115
        self.assertFalse(osutils.contains_whitespace(u''))
 
116
        self.assertFalse(osutils.contains_whitespace(u'hellothere'))
 
117
        self.assertFalse(osutils.contains_whitespace(u'hello\xa0there'))
122
118
 
123
119
 
124
120
class TestRename(tests.TestCaseInTempDir):
138
134
        # This should work everywhere
139
135
        self.create_file('a', 'something in a\n')
140
136
        self._fancy_rename('a', 'b')
141
 
        self.failIfExists('a')
142
 
        self.failUnlessExists('b')
 
137
        self.assertPathDoesNotExist('a')
 
138
        self.assertPathExists('b')
143
139
        self.check_file_contents('b', 'something in a\n')
144
140
 
145
141
        self.create_file('a', 'new something in a\n')
152
148
        self.create_file('target', 'data in target\n')
153
149
        self.assertRaises((IOError, OSError), self._fancy_rename,
154
150
                          'missingsource', 'target')
155
 
        self.failUnlessExists('target')
 
151
        self.assertPathExists('target')
156
152
        self.check_file_contents('target', 'data in target\n')
157
153
 
158
154
    def test_fancy_rename_fails_if_source_and_target_missing(self):
163
159
        # Rename should be semi-atomic on all platforms
164
160
        self.create_file('a', 'something in a\n')
165
161
        osutils.rename('a', 'b')
166
 
        self.failIfExists('a')
167
 
        self.failUnlessExists('b')
 
162
        self.assertPathDoesNotExist('a')
 
163
        self.assertPathExists('b')
168
164
        self.check_file_contents('b', 'something in a\n')
169
165
 
170
166
        self.create_file('a', 'new something in a\n')
184
180
        shape = sorted(os.listdir('.'))
185
181
        self.assertEquals(['A', 'B'], shape)
186
182
 
187
 
    def test_rename_error(self):
188
 
        # We wrap os.rename to make it give an error including the filenames
189
 
        # https://bugs.launchpad.net/bzr/+bug/491763
190
 
        err = self.assertRaises(OSError, osutils.rename,
191
 
            'nonexistent', 'target')
192
 
        self.assertContainsString(str(err), 'nonexistent')
193
 
 
194
183
 
195
184
class TestRandChars(tests.TestCase):
196
185
 
242
231
            self.assertFalse(osutils.is_inside_or_parent_of_any(dirs, fn))
243
232
 
244
233
 
 
234
class TestLstat(tests.TestCaseInTempDir):
 
235
 
 
236
    def test_lstat_matches_fstat(self):
 
237
        # On Windows, lstat and fstat don't always agree, primarily in the
 
238
        # 'st_ino' and 'st_dev' fields. So we force them to be '0' in our
 
239
        # custom implementation.
 
240
        if sys.platform == 'win32':
 
241
            # We only have special lstat/fstat if we have the extension.
 
242
            # Without it, we may end up re-reading content when we don't have
 
243
            # to, but otherwise it doesn't effect correctness.
 
244
            self.requireFeature(test__walkdirs_win32.win32_readdir_feature)
 
245
        f = open('test-file.txt', 'wb')
 
246
        self.addCleanup(f.close)
 
247
        f.write('some content\n')
 
248
        f.flush()
 
249
        self.assertEqualStat(osutils.fstat(f.fileno()),
 
250
                             osutils.lstat('test-file.txt'))
 
251
 
 
252
 
245
253
class TestRmTree(tests.TestCaseInTempDir):
246
254
 
247
255
    def test_rmtree(self):
259
267
 
260
268
        osutils.rmtree('dir')
261
269
 
262
 
        self.failIfExists('dir/file')
263
 
        self.failIfExists('dir')
 
270
        self.assertPathDoesNotExist('dir/file')
 
271
        self.assertPathDoesNotExist('dir')
264
272
 
265
273
 
266
274
class TestDeleteAny(tests.TestCaseInTempDir):
480
488
        f = file('MixedCaseName', 'w')
481
489
        f.close()
482
490
        actual = osutils.canonical_relpath(self.test_base_dir, 'mixedcasename')
483
 
        self.failUnlessEqual('work/MixedCaseName', actual)
 
491
        self.assertEqual('work/MixedCaseName', actual)
484
492
 
485
493
    def test_canonical_relpath_missing_tail(self):
486
494
        os.mkdir('MixedCaseParent')
487
495
        actual = osutils.canonical_relpath(self.test_base_dir,
488
496
                                           'mixedcaseparent/nochild')
489
 
        self.failUnlessEqual('work/MixedCaseParent/nochild', actual)
 
497
        self.assertEqual('work/MixedCaseParent/nochild', actual)
490
498
 
491
499
 
492
500
class Test_CICPCanonicalRelpath(tests.TestCaseWithTransport):
810
818
        self.assertEqual(None, osutils.safe_file_id(None))
811
819
 
812
820
 
 
821
class TestPosixFuncs(tests.TestCase):
 
822
    """Test that the posix version of normpath returns an appropriate path
 
823
       when used with 2 leading slashes."""
 
824
 
 
825
    def test_normpath(self):
 
826
        self.assertEqual('/etc/shadow', osutils._posix_normpath('/etc/shadow'))
 
827
        self.assertEqual('/etc/shadow', osutils._posix_normpath('//etc/shadow'))
 
828
        self.assertEqual('/etc/shadow', osutils._posix_normpath('///etc/shadow'))
 
829
 
 
830
 
813
831
class TestWin32Funcs(tests.TestCase):
814
832
    """Test that _win32 versions of os utilities return appropriate paths."""
815
833
 
868
886
        self.assertEqual('//HOST/path', osutils._win98_abspath('//HOST/path'))
869
887
        # relative path
870
888
        cwd = osutils.getcwd().rstrip('/')
871
 
        drive = osutils._nt_splitdrive(cwd)[0]
 
889
        drive = osutils.ntpath.splitdrive(cwd)[0]
872
890
        self.assertEqual(cwd+'/path', osutils._win98_abspath('path'))
873
891
        self.assertEqual(drive+'/path', osutils._win98_abspath('/path'))
874
892
        # unicode path
916
934
        b.close()
917
935
 
918
936
        osutils._win32_rename('b', 'a')
919
 
        self.failUnlessExists('a')
920
 
        self.failIfExists('b')
 
937
        self.assertPathExists('a')
 
938
        self.assertPathDoesNotExist('b')
921
939
        self.assertFileEqual('baz\n', 'a')
922
940
 
923
941
    def test_rename_missing_file(self):
1071
1089
        self.assertExpectedBlocks(expected_dirblocks[1:], result)
1072
1090
 
1073
1091
    def test_walkdirs_os_error(self):
1074
 
        # <https://bugs.edge.launchpad.net/bzr/+bug/338653>
 
1092
        # <https://bugs.launchpad.net/bzr/+bug/338653>
1075
1093
        # Pyrex readdir didn't raise useful messages if it had an error
1076
1094
        # reading the directory
1077
1095
        if sys.platform == 'win32':
1078
1096
            raise tests.TestNotApplicable(
1079
1097
                "readdir IOError not tested on win32")
 
1098
        self.requireFeature(features.not_running_as_root)
1080
1099
        os.mkdir("test-unreadable")
1081
1100
        os.chmod("test-unreadable", 0000)
1082
1101
        # must chmod it back so that it can be removed
1090
1109
        # Ensure the message contains the file name
1091
1110
        self.assertContainsRe(str(e), "\./test-unreadable")
1092
1111
 
 
1112
 
 
1113
    def test_walkdirs_encoding_error(self):
 
1114
        # <https://bugs.launchpad.net/bzr/+bug/488519>
 
1115
        # walkdirs didn't raise a useful message when the filenames
 
1116
        # are not using the filesystem's encoding
 
1117
 
 
1118
        # require a bytestring based filesystem
 
1119
        self.requireFeature(tests.ByteStringNamedFilesystem)
 
1120
 
 
1121
        tree = [
 
1122
            '.bzr',
 
1123
            '0file',
 
1124
            '1dir/',
 
1125
            '1dir/0file',
 
1126
            '1dir/1dir/',
 
1127
            '1file'
 
1128
            ]
 
1129
 
 
1130
        self.build_tree(tree)
 
1131
 
 
1132
        # rename the 1file to a latin-1 filename
 
1133
        os.rename("./1file", "\xe8file")
 
1134
        if "\xe8file" not in os.listdir("."):
 
1135
            self.skip("Lack filesystem that preserves arbitrary bytes")
 
1136
 
 
1137
        self._save_platform_info()
 
1138
        win32utils.winver = None # Avoid the win32 detection code
 
1139
        osutils._fs_enc = 'UTF-8'
 
1140
 
 
1141
        # this should raise on error
 
1142
        def attempt():
 
1143
            for dirdetail, dirblock in osutils.walkdirs('.'):
 
1144
                pass
 
1145
 
 
1146
        self.assertRaises(errors.BadFilenameEncoding, attempt)
 
1147
 
1093
1148
    def test__walkdirs_utf8(self):
1094
1149
        tree = [
1095
1150
            '.bzr',
1569
1624
                          ('d', 'source/b', 'target/b'),
1570
1625
                          ('f', 'source/b/c', 'target/b/c'),
1571
1626
                         ], processed_files)
1572
 
        self.failIfExists('target')
 
1627
        self.assertPathDoesNotExist('target')
1573
1628
        if osutils.has_symlinks():
1574
1629
            self.assertEqual([('source/lnk', 'target/lnk')], processed_links)
1575
1630
 
1621
1676
        old = osutils.set_or_unset_env('BZR_TEST_ENV_VAR', None)
1622
1677
        self.assertEqual('foo', old)
1623
1678
        self.assertEqual(None, os.environ.get('BZR_TEST_ENV_VAR'))
1624
 
        self.failIf('BZR_TEST_ENV_VAR' in os.environ)
 
1679
        self.assertFalse('BZR_TEST_ENV_VAR' in os.environ)
1625
1680
 
1626
1681
 
1627
1682
class TestSizeShaFile(tests.TestCaseInTempDir):
1678
1733
 
1679
1734
class TestReCompile(tests.TestCase):
1680
1735
 
 
1736
    def _deprecated_re_compile_checked(self, *args, **kwargs):
 
1737
        return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),
 
1738
            osutils.re_compile_checked, *args, **kwargs)
 
1739
 
1681
1740
    def test_re_compile_checked(self):
1682
 
        r = osutils.re_compile_checked(r'A*', re.IGNORECASE)
 
1741
        r = self._deprecated_re_compile_checked(r'A*', re.IGNORECASE)
1683
1742
        self.assertTrue(r.match('aaaa'))
1684
1743
        self.assertTrue(r.match('aAaA'))
1685
1744
 
1686
1745
    def test_re_compile_checked_error(self):
1687
1746
        # like https://bugs.launchpad.net/bzr/+bug/251352
 
1747
 
 
1748
        # Due to possible test isolation error, re.compile is not lazy at
 
1749
        # this point. We re-install lazy compile.
 
1750
        lazy_regex.install_lazy_compile()
1688
1751
        err = self.assertRaises(
1689
1752
            errors.BzrCommandError,
1690
 
            osutils.re_compile_checked, '*', re.IGNORECASE, 'test case')
 
1753
            self._deprecated_re_compile_checked, '*', re.IGNORECASE, 'test case')
1691
1754
        self.assertEqual(
1692
 
            "Invalid regular expression in test case: '*': "
1693
 
            "nothing to repeat",
 
1755
            'Invalid regular expression in test case: '
 
1756
            '"*" nothing to repeat',
1694
1757
            str(err))
1695
1758
 
1696
1759
 
1697
1760
class TestDirReader(tests.TestCaseInTempDir):
1698
1761
 
 
1762
    scenarios = dir_reader_scenarios()
 
1763
 
1699
1764
    # Set by load_tests
1700
1765
    _dir_reader_class = None
1701
1766
    _native_to_unicode = None
1842
1907
        os.symlink(self.target, self.link)
1843
1908
 
1844
1909
    def test_os_readlink_link_encoding(self):
1845
 
        if sys.version_info < (2, 6):
1846
 
            self.assertRaises(UnicodeEncodeError, os.readlink, self.link)
1847
 
        else:
1848
 
            self.assertEquals(self.target,  os.readlink(self.link))
 
1910
        self.assertEquals(self.target,  os.readlink(self.link))
1849
1911
 
1850
1912
    def test_os_readlink_link_decoding(self):
1851
1913
        self.assertEquals(self.target.encode(osutils._fs_enc),
1863
1925
        self.assertIsInstance(concurrency, int)
1864
1926
 
1865
1927
    def test_local_concurrency_environment_variable(self):
1866
 
        os.environ['BZR_CONCURRENCY'] = '2'
 
1928
        self.overrideEnv('BZR_CONCURRENCY', '2')
1867
1929
        self.assertEqual(2, osutils.local_concurrency(use_cache=False))
1868
 
        os.environ['BZR_CONCURRENCY'] = '3'
 
1930
        self.overrideEnv('BZR_CONCURRENCY', '3')
1869
1931
        self.assertEqual(3, osutils.local_concurrency(use_cache=False))
1870
 
        os.environ['BZR_CONCURRENCY'] = 'foo'
 
1932
        self.overrideEnv('BZR_CONCURRENCY', 'foo')
1871
1933
        self.assertEqual(1, osutils.local_concurrency(use_cache=False))
1872
1934
 
1873
1935
    def test_option_concurrency(self):
1874
 
        os.environ['BZR_CONCURRENCY'] = '1'
 
1936
        self.overrideEnv('BZR_CONCURRENCY', '1')
1875
1937
        self.run_bzr('rocks --concurrency 42')
1876
 
        # Command line overrides envrionment variable
 
1938
        # Command line overrides environment variable
1877
1939
        self.assertEquals('42', os.environ['BZR_CONCURRENCY'])
1878
1940
        self.assertEquals(42, osutils.local_concurrency(use_cache=False))
1879
1941
 
1917
1979
 
1918
1980
class TestTerminalWidth(tests.TestCase):
1919
1981
 
 
1982
    def setUp(self):
 
1983
        tests.TestCase.setUp(self)
 
1984
        self._orig_terminal_size_state = osutils._terminal_size_state
 
1985
        self._orig_first_terminal_size = osutils._first_terminal_size
 
1986
        self.addCleanup(self.restore_osutils_globals)
 
1987
        osutils._terminal_size_state = 'no_data'
 
1988
        osutils._first_terminal_size = None
 
1989
 
 
1990
    def restore_osutils_globals(self):
 
1991
        osutils._terminal_size_state = self._orig_terminal_size_state
 
1992
        osutils._first_terminal_size = self._orig_first_terminal_size
 
1993
 
1920
1994
    def replace_stdout(self, new):
1921
1995
        self.overrideAttr(sys, 'stdout', new)
1922
1996
 
1937
2011
    def test_defaults_to_BZR_COLUMNS(self):
1938
2012
        # BZR_COLUMNS is set by the test framework
1939
2013
        self.assertNotEqual('12', os.environ['BZR_COLUMNS'])
1940
 
        os.environ['BZR_COLUMNS'] = '12'
 
2014
        self.overrideEnv('BZR_COLUMNS', '12')
1941
2015
        self.assertEqual(12, osutils.terminal_width())
1942
2016
 
 
2017
    def test_BZR_COLUMNS_0_no_limit(self):
 
2018
        self.overrideEnv('BZR_COLUMNS', '0')
 
2019
        self.assertEqual(None, osutils.terminal_width())
 
2020
 
1943
2021
    def test_falls_back_to_COLUMNS(self):
1944
 
        del os.environ['BZR_COLUMNS']
 
2022
        self.overrideEnv('BZR_COLUMNS', None)
1945
2023
        self.assertNotEqual('42', os.environ['COLUMNS'])
1946
2024
        self.set_fake_tty()
1947
 
        os.environ['COLUMNS'] = '42'
 
2025
        self.overrideEnv('COLUMNS', '42')
1948
2026
        self.assertEqual(42, osutils.terminal_width())
1949
2027
 
1950
2028
    def test_tty_default_without_columns(self):
1951
 
        del os.environ['BZR_COLUMNS']
1952
 
        del os.environ['COLUMNS']
 
2029
        self.overrideEnv('BZR_COLUMNS', None)
 
2030
        self.overrideEnv('COLUMNS', None)
1953
2031
 
1954
2032
        def terminal_size(w, h):
1955
2033
            return 42, 42
1962
2040
        self.assertEqual(42, osutils.terminal_width())
1963
2041
 
1964
2042
    def test_non_tty_default_without_columns(self):
1965
 
        del os.environ['BZR_COLUMNS']
1966
 
        del os.environ['COLUMNS']
 
2043
        self.overrideEnv('BZR_COLUMNS', None)
 
2044
        self.overrideEnv('COLUMNS', None)
1967
2045
        self.replace_stdout(None)
1968
2046
        self.assertEqual(None, osutils.terminal_width())
1969
2047
 
1979
2057
        else:
1980
2058
            self.overrideAttr(termios, 'TIOCGWINSZ')
1981
2059
            del termios.TIOCGWINSZ
1982
 
        del os.environ['BZR_COLUMNS']
1983
 
        del os.environ['COLUMNS']
 
2060
        self.overrideEnv('BZR_COLUMNS', None)
 
2061
        self.overrideEnv('COLUMNS', None)
1984
2062
        # Whatever the result is, if we don't raise an exception, it's ok.
1985
2063
        osutils.terminal_width()
1986
2064
 
 
2065
 
1987
2066
class TestCreationOps(tests.TestCaseInTempDir):
1988
2067
    _test_needs_features = [features.chown_feature]
1989
2068
 
2018
2097
        self.assertEquals(self.path, 'test_file')
2019
2098
        self.assertEquals(self.uid, s.st_uid)
2020
2099
        self.assertEquals(self.gid, s.st_gid)
 
2100
 
 
2101
 
 
2102
class TestGetuserUnicode(tests.TestCase):
 
2103
 
 
2104
    def test_ascii_user(self):
 
2105
        self.overrideEnv('LOGNAME', 'jrandom')
 
2106
        self.assertEqual(u'jrandom', osutils.getuser_unicode())
 
2107
 
 
2108
    def test_unicode_user(self):
 
2109
        ue = osutils.get_user_encoding()
 
2110
        uni_val, env_val = tests.probe_unicode_in_user_encoding()
 
2111
        if uni_val is None:
 
2112
            raise tests.TestSkipped(
 
2113
                'Cannot find a unicode character that works in encoding %s'
 
2114
                % (osutils.get_user_encoding(),))
 
2115
        uni_username = u'jrandom' + uni_val
 
2116
        encoded_username = uni_username.encode(ue)
 
2117
        self.overrideEnv('LOGNAME', encoded_username)
 
2118
        self.assertEqual(uni_username, osutils.getuser_unicode())
 
2119
        self.overrideEnv('LOGNAME', u'jrandom\xb6'.encode(ue))
 
2120
        self.assertEqual(u'jrandom\xb6', osutils.getuser_unicode())
 
2121
 
 
2122
    def test_no_username_bug_660174(self):
 
2123
        self.requireFeature(features.win32_feature)
 
2124
        for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
 
2125
            self.overrideEnv(name, None)
 
2126
        self.assertEqual(u'UNKNOWN', osutils.getuser_unicode())
 
2127
 
 
2128
 
 
2129
class TestBackupNames(tests.TestCase):
 
2130
 
 
2131
    def setUp(self):
 
2132
        super(TestBackupNames, self).setUp()
 
2133
        self.backups = []
 
2134
 
 
2135
    def backup_exists(self, name):
 
2136
        return name in self.backups
 
2137
 
 
2138
    def available_backup_name(self, name):
 
2139
        backup_name = osutils.available_backup_name(name, self.backup_exists)
 
2140
        self.backups.append(backup_name)
 
2141
        return backup_name
 
2142
 
 
2143
    def assertBackupName(self, expected, name):
 
2144
        self.assertEqual(expected, self.available_backup_name(name))
 
2145
 
 
2146
    def test_empty(self):
 
2147
        self.assertBackupName('file.~1~', 'file')
 
2148
 
 
2149
    def test_existing(self):
 
2150
        self.available_backup_name('file')
 
2151
        self.available_backup_name('file')
 
2152
        self.assertBackupName('file.~3~', 'file')
 
2153
        # Empty slots are found, this is not a strict requirement and may be
 
2154
        # revisited if we test against all implementations.
 
2155
        self.backups.remove('file.~2~')
 
2156
        self.assertBackupName('file.~2~', 'file')
 
2157
 
 
2158
 
 
2159
class TestFindExecutableInPath(tests.TestCase):
 
2160
 
 
2161
    def test_windows(self):
 
2162
        if sys.platform != 'win32':
 
2163
            raise tests.TestSkipped('test requires win32')
 
2164
        self.assertTrue(osutils.find_executable_on_path('explorer') is not None)
 
2165
        self.assertTrue(
 
2166
            osutils.find_executable_on_path('explorer.exe') is not None)
 
2167
        self.assertTrue(
 
2168
            osutils.find_executable_on_path('EXPLORER.EXE') is not None)
 
2169
        self.assertTrue(
 
2170
            osutils.find_executable_on_path('THIS SHOULD NOT EXIST') is None)
 
2171
        self.assertTrue(osutils.find_executable_on_path('file.txt') is None)
 
2172
 
 
2173
    def test_other(self):
 
2174
        if sys.platform == 'win32':
 
2175
            raise tests.TestSkipped('test requires non-win32')
 
2176
        self.assertTrue(osutils.find_executable_on_path('sh') is not None)
 
2177
        self.assertTrue(
 
2178
            osutils.find_executable_on_path('THIS SHOULD NOT EXIST') is None)