@@ -256,6 +256,7 @@ def test_urls(config, public_url, local_url, connection_url):
256
256
257
257
# Preferred dir tests
258
258
# ----------------------------------------------------------------------------
259
+ @pytest .mark .filterwarnings ("ignore::FutureWarning" )
259
260
def test_valid_preferred_dir (tmp_path , jp_configurable_serverapp ):
260
261
path = str (tmp_path )
261
262
app = jp_configurable_serverapp (root_dir = path , preferred_dir = path )
@@ -264,6 +265,7 @@ def test_valid_preferred_dir(tmp_path, jp_configurable_serverapp):
264
265
assert app .root_dir == app .preferred_dir
265
266
266
267
268
+ @pytest .mark .filterwarnings ("ignore::FutureWarning" )
267
269
def test_valid_preferred_dir_is_root_subdir (tmp_path , jp_configurable_serverapp ):
268
270
path = str (tmp_path )
269
271
path_subdir = str (tmp_path / "subdir" )
@@ -284,7 +286,7 @@ def test_valid_preferred_dir_does_not_exist(tmp_path, jp_configurable_serverapp)
284
286
285
287
286
288
# This tests some deprecated behavior as well
287
- @pytest .mark .filterwarnings ("ignore::DeprecationWarning " )
289
+ @pytest .mark .filterwarnings ("ignore::FutureWarning " )
288
290
@pytest .mark .parametrize (
289
291
"root_dir_loc,preferred_dir_loc" ,
290
292
[
@@ -335,9 +337,8 @@ def test_preferred_dir_validation(
335
337
kwargs ["argv" ] = argv # type:ignore
336
338
337
339
if root_dir_loc == "default" and preferred_dir_loc != "default" : # error expected
338
- app = jp_configurable_serverapp (** kwargs )
339
- with pytest .raises (TraitError ):
340
- app .contents_manager .preferred_dir
340
+ with pytest .raises (SystemExit ):
341
+ jp_configurable_serverapp (** kwargs )
341
342
else :
342
343
app = jp_configurable_serverapp (** kwargs )
343
344
assert app .root_dir == expected_root_dir
@@ -368,18 +369,14 @@ def test_invalid_preferred_dir_does_not_exist_set(tmp_path, jp_configurable_serv
368
369
assert "No such preferred dir:" in str (error )
369
370
370
371
371
- @pytest .mark .filterwarnings ("ignore::DeprecationWarning " )
372
+ @pytest .mark .filterwarnings ("ignore::FutureWarning " )
372
373
def test_invalid_preferred_dir_not_root_subdir (tmp_path , jp_configurable_serverapp ):
373
374
path = str (tmp_path / "subdir" )
374
375
os .makedirs (path , exist_ok = True )
375
376
not_subdir_path = str (tmp_path )
376
377
377
- with pytest .raises (TraitError ) as error :
378
- app = jp_configurable_serverapp (root_dir = path , preferred_dir = not_subdir_path )
379
- # reading the value triggers default generator:
380
- app .contents_manager .preferred_dir
381
-
382
- assert "is outside root contents directory" in str (error )
378
+ with pytest .raises (SystemExit ):
379
+ jp_configurable_serverapp (root_dir = path , preferred_dir = not_subdir_path )
383
380
384
381
385
382
def test_invalid_preferred_dir_not_root_subdir_set (tmp_path , jp_configurable_serverapp ):
0 commit comments