From ad09dbf52ed1f66f3f090897195d2382600178a1 Mon Sep 17 00:00:00 2001 From: Florian Bussmann Date: Tue, 6 Apr 2021 01:25:28 +0200 Subject: [PATCH] Return canonical path when using %APPDATA% on NT jupyterlab/jupyterlab#9250 jupyter-server/jupyter_server#435 jupyter/notebook#5996 --- jupyter_core/paths.py | 2 +- jupyter_core/tests/test_paths.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jupyter_core/paths.py b/jupyter_core/paths.py index 4bee4ff..90e1c99 100644 --- a/jupyter_core/paths.py +++ b/jupyter_core/paths.py @@ -90,7 +90,7 @@ def jupyter_data_dir(): elif os.name == 'nt': appdata = os.environ.get('APPDATA', None) if appdata: - return pjoin(appdata, 'jupyter') + return os.path.realpath(pjoin(appdata, 'jupyter')) else: return pjoin(jupyter_config_dir(), 'data') else: diff --git a/jupyter_core/tests/test_paths.py b/jupyter_core/tests/test_paths.py index 6d37d22..814dbd3 100644 --- a/jupyter_core/tests/test_paths.py +++ b/jupyter_core/tests/test_paths.py @@ -116,12 +116,12 @@ def test_data_dir_darwin(): def test_data_dir_windows(): with windows, appdata: data = jupyter_data_dir() - assert data == pjoin('appdata', 'jupyter') + assert data == realpath(pjoin('appdata', 'jupyter')) with windows, appdata, xdg: # windows should ignore xdg data = jupyter_data_dir() - assert data == pjoin('appdata', 'jupyter') + assert data == realpath(pjoin('appdata', 'jupyter')) def test_data_dir_linux(): @@ -155,12 +155,12 @@ def test_runtime_dir_darwin(): def test_runtime_dir_windows(): with windows, appdata: runtime = jupyter_runtime_dir() - assert runtime == pjoin('appdata', 'jupyter', 'runtime') + assert runtime == realpath(pjoin('appdata', 'jupyter', 'runtime')) with windows, appdata, xdg: # windows should ignore xdg runtime = jupyter_runtime_dir() - assert runtime == pjoin('appdata', 'jupyter', 'runtime') + assert runtime == realpath(pjoin('appdata', 'jupyter', 'runtime')) def test_runtime_dir_linux():