@@ -198,11 +198,15 @@ def test_jupyter_path():
198
198
def test_jupyter_path_user_site ():
199
199
with no_config_env , patch .object (site , 'ENABLE_USER_SITE' , True ):
200
200
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
206
210
207
211
def test_jupyter_path_no_user_site ():
208
212
with no_config_env , patch .object (site , 'ENABLE_USER_SITE' , False ):
@@ -241,11 +245,15 @@ def test_jupyter_path_subdir():
241
245
def test_jupyter_config_path ():
242
246
with patch .object (site , 'ENABLE_USER_SITE' , True ):
243
247
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
+
249
+ # deduplicated expected values
250
+ values = list (dict .fromkeys ([
251
+ jupyter_config_dir (),
252
+ os .path .join (site .getuserbase (), 'etc' , 'jupyter' ),
253
+ paths .ENV_CONFIG_PATH [0 ]
254
+ ]))
255
+ for p ,v in zip (path , values ):
256
+ assert p == v
249
257
250
258
def test_jupyter_config_path_no_user_site ():
251
259
with patch .object (site , 'ENABLE_USER_SITE' , False ):
@@ -255,11 +263,17 @@ def test_jupyter_config_path_no_user_site():
255
263
256
264
257
265
def test_jupyter_config_path_prefer_env ():
258
- with prefer_env :
266
+ with prefer_env , patch . object ( site , 'ENABLE_USER_SITE' , True ) :
259
267
path = jupyter_config_path ()
260
- assert path [0 ] == paths .ENV_CONFIG_PATH [0 ]
261
- assert path [1 ] == jupyter_config_dir ()
262
- assert path [2 ] == os .path .join (site .USER_BASE , 'etc' , 'jupyter' )
268
+
269
+ # deduplicated expected values
270
+ values = list (dict .fromkeys ([
271
+ paths .ENV_CONFIG_PATH [0 ],
272
+ jupyter_config_dir (),
273
+ os .path .join (site .getuserbase (), 'etc' , 'jupyter' )
274
+ ]))
275
+ for p ,v in zip (path , values ):
276
+ assert p == v
263
277
264
278
def test_jupyter_config_path_env ():
265
279
path_env = os .pathsep .join ([
0 commit comments