Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e5c2e2

Browse files
authored
Merge pull request #13181 from haobibo/master
create ipython_dir if not exists
2 parents 5aabdc1 + 397338f commit 4e5c2e2

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

IPython/core/tests/test_paths.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def test_get_ipython_dir_7():
160160
@skip_win32
161161
def test_get_ipython_dir_8():
162162
"""test_get_ipython_dir_8, test / home directory"""
163+
if not os.access("/", os.W_OK):
164+
# test only when HOME directory actually writable
165+
return
166+
163167
with patch.object(paths, '_writable_dir', lambda path: bool(path)), \
164168
patch.object(paths, 'get_xdg_dir', return_value=None), \
165169
modified_env({

IPython/paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def get_ipython_dir() -> str:
7171
warn("IPython parent '{0}' is not a writable location,"
7272
" using a temp directory.".format(parent))
7373
ipdir = tempfile.mkdtemp()
74+
else:
75+
os.makedirs(ipdir)
7476
assert isinstance(ipdir, str), "all path manipulation should be str(unicode), but are not."
7577
return ipdir
7678

0 commit comments

Comments
 (0)