Skip to content

Commit a972827

Browse files
committed
Clean up path deduplication test
1 parent 09fa118 commit a972827

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

jupyter_core/tests/test_paths.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,15 @@ 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-
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]
201+
202+
# deduplicated expected values
203+
values = list(dict.fromkeys([
204+
jupyter_data_dir(),
205+
os.path.join(site.getuserbase(), 'share', 'jupyter'),
206+
paths.ENV_JUPYTER_PATH[0]
207+
]))
208+
for p,v in zip(path, values):
209+
assert p == v
206210

207211
def test_jupyter_path_no_user_site():
208212
with no_config_env, patch.object(site, 'ENABLE_USER_SITE', False):
@@ -241,11 +245,14 @@ def test_jupyter_path_subdir():
241245
def test_jupyter_config_path():
242246
with patch.object(site, 'ENABLE_USER_SITE', True):
243247
path = jupyter_config_path()
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]
248+
# deduplicated expected values
249+
values = list(dict.fromkeys([
250+
jupyter_config_dir(),
251+
os.path.join(site.USER_BASE, 'etc', 'jupyter'),
252+
paths.ENV_CONFIG_PATH[0]
253+
]))
254+
for p,v in zip(path, values):
255+
assert p == v
249256

250257
def test_jupyter_config_path_no_user_site():
251258
with patch.object(site, 'ENABLE_USER_SITE', False):

0 commit comments

Comments
 (0)