##// END OF EJS Templates
Fixing broken tests on win32....
bgranger -
Show More
@@ -47,6 +47,7 b' def test_io():'
47 47 assert result == test_string
48 48
49 49
50 @testdec.skip_win32
50 51 def test_kill():
51 52 """ Check that we can kill a process, and its subprocess.
52 53 """
@@ -145,11 +145,11 b' def get_home_dir():'
145 145
146 146 * On POSIX, we try $HOME.
147 147 * On Windows we try:
148 - %HOME%: rare, but some people with unix-like setups may have defined it
149 148 - %HOMESHARE%
150 149 - %HOMEDRIVE\%HOMEPATH%
151 150 - %USERPROFILE%
152 - Registry hack
151 - Registry hack for My Documents
152 - %HOME%: rare, but some people with unix-like setups may have defined it
153 153 * On Dos C:\
154 154
155 155 Currently only Posix and NT are implemented, a HomeDirError exception is
@@ -25,7 +25,7 b' from nose import with_setup'
25 25
26 26 import IPython
27 27 from IPython.testing import decorators as dec
28 from IPython.testing.decorators import skip_if_not_win32
28 from IPython.testing.decorators import skip_if_not_win32, skip_win32
29 29 from IPython.utils import path
30 30
31 31 # Platform-dependent imports
@@ -114,7 +114,7 b' def test_get_home_dir_1():'
114 114 #fake filename for IPython.__init__
115 115 IPython.__file__ = abspath(join(HOME_TEST_DIR, "Lib/IPython/__init__.py"))
116 116
117 path.home_dir = get_home_dir()
117 home_dir = path.get_home_dir()
118 118 nt.assert_equal(home_dir, abspath(HOME_TEST_DIR))
119 119
120 120
@@ -132,6 +132,7 b' def test_get_home_dir_2():'
132 132
133 133
134 134 @with_environment
135 @skip_win32
135 136 def test_get_home_dir_3():
136 137 """Testcase $HOME is set, then use its value as home directory."""
137 138 env["HOME"] = HOME_TEST_DIR
@@ -152,13 +153,14 b' def test_get_home_dir_4():'
152 153 @skip_if_not_win32
153 154 @with_environment
154 155 def test_get_home_dir_5():
155 """Testcase $HOME is not set, os=='nt'
156 env['HOMEDRIVE'],env['HOMEPATH'] points to path."""
156 """Using HOMEDRIVE + HOMEPATH, os=='nt'.
157
158 HOMESHARE is missing.
159 """
157 160
158 161 os.name = 'nt'
159 if 'HOME' in env: del env['HOME']
162 env.pop('HOMESHARE', None)
160 163 env['HOMEDRIVE'], env['HOMEPATH'] = os.path.splitdrive(HOME_TEST_DIR)
161
162 164 home_dir = path.get_home_dir()
163 165 nt.assert_equal(home_dir, abspath(HOME_TEST_DIR))
164 166
@@ -166,27 +168,37 b' def test_get_home_dir_5():'
166 168 @skip_if_not_win32
167 169 @with_environment
168 170 def test_get_home_dir_6():
169 """Testcase $HOME is not set, os=='nt'
170 env['HOMEDRIVE'],env['HOMEPATH'] do not point to path.
171 env['USERPROFILE'] points to path
171 """Using USERPROFILE, os=='nt'.
172
173 HOMESHARE, HOMEDRIVE, HOMEPATH are missing.
172 174 """
173 175
174 176 os.name = 'nt'
175 if 'HOME' in env: del env['HOME']
176 env['HOMEDRIVE'], env['HOMEPATH'] = os.path.abspath(TEST_FILE_PATH), "DOES NOT EXIST"
177 env.pop('HOMESHARE', None)
178 env.pop('HOMEDRIVE', None)
179 env.pop('HOMEPATH', None)
177 180 env["USERPROFILE"] = abspath(HOME_TEST_DIR)
178
179 181 home_dir = path.get_home_dir()
180 182 nt.assert_equal(home_dir, abspath(HOME_TEST_DIR))
181 183
182 184
183 # Should we stub wreg fully so we can run the test on all platforms?
184 185 @skip_if_not_win32
185 186 @with_environment
186 187 def test_get_home_dir_7():
187 """Testcase $HOME is not set, os=='nt'
188 """Using HOMESHARE, os=='nt'."""
189
190 os.name = 'nt'
191 env["HOMESHARE"] = abspath(HOME_TEST_DIR)
192 home_dir = path.get_home_dir()
193 nt.assert_equal(home_dir, abspath(HOME_TEST_DIR))
194
195 # Should we stub wreg fully so we can run the test on all platforms?
196 @skip_if_not_win32
197 @with_environment
198 def test_get_home_dir_8():
199 """Using registry hack for 'My Documents', os=='nt'
188 200
189 env['HOMEDRIVE'],env['HOMEPATH'], env['USERPROFILE'] and others missing
201 HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing.
190 202 """
191 203 os.name = 'nt'
192 204 # Remove from stub environment all keys that may be set
General Comments 0
You need to be logged in to leave comments. Login now