File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,15 @@ def test_font_priority():
31
31
def test_json_serialization ():
32
32
# on windows, we can't open a file twice, so save the name and unlink
33
33
# manually...
34
- with tempfile .NamedTemporaryFile (delete = False ) as temp :
35
- name = temp .name
36
- json_dump (fontManager , name )
37
- copy = json_load (name )
38
- os .remove (name )
34
+ try :
35
+ name = None
36
+ with tempfile .NamedTemporaryFile (delete = False ) as temp :
37
+ name = temp .name
38
+ json_dump (fontManager , name )
39
+ copy = json_load (name )
40
+ finally :
41
+ if name and os .path .exists (name ):
42
+ os .remove (name )
39
43
with warnings .catch_warnings ():
40
44
warnings .filterwarnings ('ignore' , 'findfont: Font family.*not found' )
41
45
for prop in ({'family' : 'STIXGeneral' },
You can’t perform that action at this time.
0 commit comments