File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,6 @@ def test_file_with_invalid_permission(self):
245
245
f'The output is:\n { result .output } '
246
246
assert os .path .exists ('test_graph.svg' )
247
247
if OS .windows :
248
- assert os .path .getsize ('test_graph.svg' ) <= 2000
248
+ assert 5000 <= os .path .getsize ('test_graph.svg' ) <= 6500
249
249
else :
250
- assert os .path .getsize ('test_graph.svg' ) <= 1000
250
+ assert 500 <= os .path .getsize ('test_graph.svg' ) <= 1000
Original file line number Diff line number Diff line change @@ -60,9 +60,11 @@ def _save_source_code(g: Digraph, path: str):
60
60
file .write (g .source )
61
61
62
62
63
+ # Do not reopen an opened file in windows, it may cause PermissionDenied
64
+ # See: https://stackoverflow.com/a/23212515/6995899
63
65
def _save_image (g : Digraph , path : str , fmt : str ):
64
- with tempfile .NamedTemporaryFile () as tmpfile :
65
- svg_file = g .render (tmpfile . name , format = fmt )
66
+ with tempfile .TemporaryDirectory () as tmpdir :
67
+ svg_file = g .render (os . path . join ( tmpdir , 'source.gv' ) , format = fmt )
66
68
shutil .copy (svg_file , path )
67
69
68
70
You can’t perform that action at this time.
0 commit comments