##// END OF EJS Templates
Various fixes for test_genutils under win32, now all tests pass.
Fernando Perez -
Show More
@@ -778,6 +778,7 b' def get_home_dir():'
778
778
779 * On POSIX, we try $HOME.
779 * On POSIX, we try $HOME.
780 * On Windows we try:
780 * On Windows we try:
781 - %HOME%: rare, but some people with unix-like setups may have defined it
781 - %HOMESHARE%
782 - %HOMESHARE%
782 - %HOMEDRIVE\%HOMEPATH%
783 - %HOMEDRIVE\%HOMEPATH%
783 - %USERPROFILE%
784 - %USERPROFILE%
@@ -820,7 +821,12 b' def get_home_dir():'
820 # is needed when running IPython on cluster where all paths have to
821 # is needed when running IPython on cluster where all paths have to
821 # be UNC.
822 # be UNC.
822 try:
823 try:
823 homedir = env['HOMESHARE']
824 # A user with a lot of unix tools in win32 may have defined $HOME,
825 # honor it if it exists, but otherwise let the more typical
826 # %HOMESHARE% variable be used.
827 homedir = env.get('HOME')
828 if homedir is None:
829 homedir = env['HOMESHARE']
824 except KeyError:
830 except KeyError:
825 pass
831 pass
826 else:
832 else:
@@ -93,8 +93,9 b' def setup_environment():'
93 if os.name == 'nt':
93 if os.name == 'nt':
94 platformstuff = (wreg.OpenKey, wreg.QueryValueEx,)
94 platformstuff = (wreg.OpenKey, wreg.QueryValueEx,)
95
95
96 if 'IPYTHONDIR' in env:
96 # Remove both spellings of env variables if present
97 del env['IPYTHONDIR']
97 env.pop('IPYTHON_DIR', None)
98 env.pop('IPYTHONDIR', None)
98
99
99 def teardown_environment():
100 def teardown_environment():
100 """Restore things that were remebered by the setup_environment function
101 """Restore things that were remebered by the setup_environment function
@@ -191,12 +192,14 b' def test_get_home_dir_6():'
191 @skip_if_not_win32
192 @skip_if_not_win32
192 @with_environment
193 @with_environment
193 def test_get_home_dir_7():
194 def test_get_home_dir_7():
194 """Testcase $HOME is not set, os=='nt'
195 """Testcase $HOME is not set, os=='nt'
195 env['HOMEDRIVE'],env['HOMEPATH'], env['USERPROFILE'] missing
196
197 env['HOMEDRIVE'],env['HOMEPATH'], env['USERPROFILE'] and others missing
196 """
198 """
197 os.name = 'nt'
199 os.name = 'nt'
198 if 'HOME' in env: del env['HOME']
200 # Remove from stub environment all keys that may be set
199 if 'HOMEDRIVE' in env: del env['HOMEDRIVE']
201 for key in ['HOME', 'HOMESHARE', 'HOMEDRIVE', 'HOMEPATH', 'USERPROFILE']:
202 env.pop(key, None)
200
203
201 #Stub windows registry functions
204 #Stub windows registry functions
202 def OpenKey(x, y):
205 def OpenKey(x, y):
@@ -220,7 +223,7 b' def test_get_home_dir_7():'
220 @with_environment
223 @with_environment
221 def test_get_ipython_dir_1():
224 def test_get_ipython_dir_1():
222 """test_get_ipython_dir_1, Testcase to see if we can call get_ipython_dir without Exceptions."""
225 """test_get_ipython_dir_1, Testcase to see if we can call get_ipython_dir without Exceptions."""
223 env['IPYTHONDIR'] = "someplace/.ipython"
226 env['IPYTHON_DIR'] = "someplace/.ipython"
224 ipdir = genutils.get_ipython_dir()
227 ipdir = genutils.get_ipython_dir()
225 nt.assert_equal(ipdir, "someplace/.ipython")
228 nt.assert_equal(ipdir, "someplace/.ipython")
226
229
General Comments 0
You need to be logged in to leave comments. Login now