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