Skip to content

Commit

Permalink
Rewrite the test using GMTTempFile
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed May 12, 2021
1 parent 9f4314f commit 4d86e78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pygmt/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest
from pygmt import Figure, set_display
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import GMTTempFile


def test_figure_region():
Expand Down Expand Up @@ -102,10 +103,9 @@ def test_figure_savefig_filename_with_spaces():
"""
fig = Figure()
fig.basemap(region=[0, 1, 0, 1], projection="X1c/1c", frame=True)
fname = "test_figure_savefig filename with spaces.png"
fig.savefig(fname)
assert os.path.exists(fname)
os.remove(fname)
with GMTTempFile(prefix="pygmt-filename with spaces", suffix=".png") as imgfile:
fig.savefig(imgfile.name)
assert os.path.exists(imgfile.name)


def test_figure_savefig():
Expand Down

0 comments on commit 4d86e78

Please sign in to comment.