Skip to content

Commit

Permalink
Clean up path deduplication test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Oct 12, 2021
1 parent 09fa118 commit a972827
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions jupyter_core/tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ def test_jupyter_path():
def test_jupyter_path_user_site():
with no_config_env, patch.object(site, 'ENABLE_USER_SITE', True):
path = jupyter_path()
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]

# deduplicated expected values
values = list(dict.fromkeys([
jupyter_data_dir(),
os.path.join(site.getuserbase(), 'share', 'jupyter'),
paths.ENV_JUPYTER_PATH[0]
]))
for p,v in zip(path, values):
assert p == v

def test_jupyter_path_no_user_site():
with no_config_env, patch.object(site, 'ENABLE_USER_SITE', False):
Expand Down Expand Up @@ -241,11 +245,14 @@ def test_jupyter_path_subdir():
def test_jupyter_config_path():
with patch.object(site, 'ENABLE_USER_SITE', True):
path = jupyter_config_path()
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]
# deduplicated expected values
values = list(dict.fromkeys([
jupyter_config_dir(),
os.path.join(site.USER_BASE, 'etc', 'jupyter'),
paths.ENV_CONFIG_PATH[0]
]))
for p,v in zip(path, values):
assert p == v

def test_jupyter_config_path_no_user_site():
with patch.object(site, 'ENABLE_USER_SITE', False):
Expand Down

0 comments on commit a972827

Please sign in to comment.