Skip to content

Commit 09fa118

Browse files
committed
Test for deduplicated user site directories
1 parent 8a06609 commit 09fa118

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

jupyter_core/tests/test_paths.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ def test_jupyter_path():
198198
def test_jupyter_path_user_site():
199199
with no_config_env, patch.object(site, 'ENABLE_USER_SITE', True):
200200
path = jupyter_path()
201-
assert path[0] == jupyter_data_dir()
202-
assert path[1] == os.path.join(site.getuserbase(), 'share', 'jupyter')
203-
assert path[2] == paths.ENV_JUPYTER_PATH[0]
201+
sitedir = os.path.join(site.getuserbase(), 'share', 'jupyter')
202+
assert path.pop(0) == jupyter_data_dir()
203+
if jupyter_data_dir() != sitedir:
204+
assert path.pop(0) == sitedir
205+
assert path.pop(0) == paths.ENV_JUPYTER_PATH[0]
204206

205207
def test_jupyter_path_no_user_site():
206208
with no_config_env, patch.object(site, 'ENABLE_USER_SITE', False):
@@ -239,9 +241,11 @@ def test_jupyter_path_subdir():
239241
def test_jupyter_config_path():
240242
with patch.object(site, 'ENABLE_USER_SITE', True):
241243
path = jupyter_config_path()
242-
assert path[0] == jupyter_config_dir()
243-
assert path[1] == os.path.join(site.USER_BASE, 'etc', 'jupyter')
244-
assert path[2] == paths.ENV_CONFIG_PATH[0]
244+
sitedir = os.path.join(site.USER_BASE, 'etc', 'jupyter')
245+
assert path.pop(0) == jupyter_config_dir()
246+
if jupyter_config_dir() != sitedir:
247+
assert path.pop(0) == sitedir
248+
assert path.pop(0) == paths.ENV_CONFIG_PATH[0]
245249

246250
def test_jupyter_config_path_no_user_site():
247251
with patch.object(site, 'ENABLE_USER_SITE', False):

0 commit comments

Comments
 (0)