File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 4
4
import os
5
5
import shutil
6
6
import tempfile
7
+ import warnings
7
8
from collections import OrderedDict
8
9
from contextlib import contextmanager
9
10
24
25
@contextmanager
25
26
def temp_style (style_name , settings = None ):
26
27
"""Context manager to create a style sheet in a temporary directory."""
27
- settings = DUMMY_SETTINGS
28
+ if not settings :
29
+ settings = DUMMY_SETTINGS
28
30
temp_file = '%s.%s' % (style_name , STYLE_EXTENSION )
29
31
30
32
# Write style settings to file in the temp directory.
@@ -44,6 +46,18 @@ def temp_style(style_name, settings=None):
44
46
style .reload_library ()
45
47
46
48
49
+ def test_deprecated_rc_warning_includes_filename ():
50
+ SETTINGS = {'axes.color_cycle' : 'ffffff' }
51
+ basename = 'color_cycle'
52
+ with warnings .catch_warnings (record = True ) as warns :
53
+ with temp_style (basename , SETTINGS ):
54
+ # style.reload_library in tempstyle() triggers the warning
55
+ pass
56
+
57
+ for w in warns :
58
+ assert basename in w .message .message
59
+
60
+
47
61
def test_available ():
48
62
with temp_style ('_test_' , DUMMY_SETTINGS ):
49
63
assert '_test_' in style .available
You can’t perform that action at this time.
0 commit comments