From 09fa118713a4eaa61188824d50409631724aafac Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 12 Oct 2021 14:09:30 -0700 Subject: [PATCH] Test for deduplicated user site directories --- jupyter_core/tests/test_paths.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/jupyter_core/tests/test_paths.py b/jupyter_core/tests/test_paths.py index 78119cc..07c8225 100644 --- a/jupyter_core/tests/test_paths.py +++ b/jupyter_core/tests/test_paths.py @@ -198,9 +198,11 @@ def test_jupyter_path(): def test_jupyter_path_user_site(): with no_config_env, patch.object(site, 'ENABLE_USER_SITE', True): path = jupyter_path() - assert path[0] == jupyter_data_dir() - assert path[1] == os.path.join(site.getuserbase(), 'share', 'jupyter') - assert path[2] == paths.ENV_JUPYTER_PATH[0] + sitedir = os.path.join(site.getuserbase(), 'share', 'jupyter') + assert path.pop(0) == jupyter_data_dir() + if jupyter_data_dir() != sitedir: + assert path.pop(0) == sitedir + assert path.pop(0) == paths.ENV_JUPYTER_PATH[0] def test_jupyter_path_no_user_site(): with no_config_env, patch.object(site, 'ENABLE_USER_SITE', False): @@ -239,9 +241,11 @@ def test_jupyter_path_subdir(): def test_jupyter_config_path(): with patch.object(site, 'ENABLE_USER_SITE', True): path = jupyter_config_path() - assert path[0] == jupyter_config_dir() - assert path[1] == os.path.join(site.USER_BASE, 'etc', 'jupyter') - assert path[2] == paths.ENV_CONFIG_PATH[0] + sitedir = os.path.join(site.USER_BASE, 'etc', 'jupyter') + assert path.pop(0) == jupyter_config_dir() + if jupyter_config_dir() != sitedir: + assert path.pop(0) == sitedir + assert path.pop(0) == paths.ENV_CONFIG_PATH[0] def test_jupyter_config_path_no_user_site(): with patch.object(site, 'ENABLE_USER_SITE', False):