@@ -21,6 +21,7 @@ def temp_style(style_name, settings=None):
2121 if not settings :
2222 settings = DUMMY_SETTINGS
2323 temp_file = f'{ style_name } .mplstyle'
24+ orig_library_paths = style .USER_LIBRARY_PATHS
2425 try :
2526 with TemporaryDirectory () as tmpdir :
2627 # Write style settings to file in the tmpdir.
@@ -32,6 +33,7 @@ def temp_style(style_name, settings=None):
3233 style .reload_library ()
3334 yield
3435 finally :
36+ style .USER_LIBRARY_PATHS = orig_library_paths
3537 style .reload_library ()
3638
3739
@@ -46,8 +48,17 @@ def test_invalid_rc_warning_includes_filename(caplog):
4648
4749
4850def test_available ():
49- with temp_style ('_test_' , DUMMY_SETTINGS ):
50- assert '_test_' in style .available
51+ # Private name should not be listed in available but still usable.
52+ assert '_classic_test_patch' not in style .available
53+ assert '_classic_test_patch' in style .library
54+
55+ with temp_style ('_test_' , DUMMY_SETTINGS ), temp_style ('dummy' , DUMMY_SETTINGS ):
56+ assert 'dummy' in style .available
57+ assert 'dummy' in style .library
58+ assert '_test_' not in style .available
59+ assert '_test_' in style .library
60+ assert 'dummy' not in style .available
61+ assert '_test_' not in style .available
5162
5263
5364def test_use ():
0 commit comments