##// END OF EJS Templates
More win32 fixes and refinements to test suite.
Fernando Perez -
Show More
@@ -79,7 +79,7 b' def find_cmd(cmd):'
79 79 return sys.executable
80 80 try:
81 81 path = _platutils.find_cmd(cmd)
82 except:
82 except OSError:
83 83 raise FindCmdError('command could not be found: %s' % cmd)
84 84 # which returns empty if not found
85 85 if path == '':
@@ -1,4 +1,3 b''
1 #!/usr/bin/env python
2 1 # encoding: utf-8
3 2 """
4 3 Tests for platutils.py
@@ -31,29 +30,43 b' def test_find_cmd_python():'
31 30 """Make sure we find sys.exectable for python."""
32 31 nt.assert_equals(find_cmd('python'), sys.executable)
33 32
33
34 34 @dec.skip_win32
35 def test_find_cmd():
35 def test_find_cmd_ls():
36 36 """Make sure we can find the full path to ls."""
37 37 path = find_cmd('ls')
38 38 nt.assert_true(path.endswith('ls'))
39 39
40 @dec.skip_if_not_win32
41 def test_find_cmd():
40
41 def has_pywin32():
42 try:
43 import win32api
44 except ImportError:
45 return False
46 return True
47
48
49 @dec.onlyif(has_pywin32, "This test requires win32api to run")
50 def test_find_cmd_pythonw():
42 51 """Try to find pythonw on Windows."""
43 52 path = find_cmd('pythonw')
44 53 nt.assert_true(path.endswith('pythonw.exe'))
45 54
55
56 @dec.onlyif(lambda : sys.platform != 'win32' or has_pywin32(),
57 "This test runs on posix or in win32 with win32api installed")
46 58 def test_find_cmd_fail():
47 59 """Make sure that FindCmdError is raised if we can't find the cmd."""
48 60 nt.assert_raises(FindCmdError,find_cmd,'asdfasdf')
49 61
62
50 63 @dec.skip_if_not_win32
51 64 def test_get_long_path_name_win32():
52 65 p = get_long_path_name('c:\\docume~1')
53 66 nt.assert_equals(p,u'c:\\Documents and Settings')
54 67
68
55 69 @dec.skip_win32
56 70 def test_get_long_path_name():
57 71 p = get_long_path_name('/usr/local')
58 72 nt.assert_equals(p,'/usr/local')
59
General Comments 0
You need to be logged in to leave comments. Login now