##// END OF EJS Templates
Fix IPython.utils.path when HOME=/.
Frank Murphy -
Show More
@@ -308,7 +308,7 b' def get_ipython_dir():'
308 " using a temp directory."%ipdir)
308 " using a temp directory."%ipdir)
309 ipdir = tempfile.mkdtemp()
309 ipdir = tempfile.mkdtemp()
310 elif not os.path.exists(ipdir):
310 elif not os.path.exists(ipdir):
311 parent = ipdir.rsplit(os.path.sep, 1)[0]
311 parent, _ = os.path.split(ipdir)
312 if not _writable_dir(parent):
312 if not _writable_dir(parent):
313 # ipdir does not exist and parent isn't writable
313 # ipdir does not exist and parent isn't writable
314 warnings.warn("IPython parent '%s' is not a writable location,"
314 warnings.warn("IPython parent '%s' is not a writable location,"
@@ -295,6 +295,17 b' def test_get_ipython_dir_7():'
295 ipdir = path.get_ipython_dir()
295 ipdir = path.get_ipython_dir()
296 nt.assert_equal(ipdir, os.path.join(home_dir, 'somewhere'))
296 nt.assert_equal(ipdir, os.path.join(home_dir, 'somewhere'))
297
297
298 @with_environment
299 def test_get_ipython_dir_8():
300 """test_get_ipython_dir_8, test / home directory"""
301 old = path._writable_dir, path.get_xdg_dir
302 try:
303 path._writable_dir = lambda path: bool(path)
304 path.get_xdg_dir = lambda: None
305 env['HOME'] = '/'
306 nt.assert_equal(path.get_ipython_dir(), '/.ipython')
307 finally:
308 path._writable_dir, path.get_xdg_dir = old
298
309
299 @with_environment
310 @with_environment
300 def test_get_xdg_dir_0():
311 def test_get_xdg_dir_0():
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now