Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 933c4f7

Browse files
committed
TST: tweak tests so they run
1 parent 1391712 commit 933c4f7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,14 @@ def psfont(*args, **kwargs):
195195
fig.savefig(tmpfile, format='pdf')
196196

197197

198-
@pytest.fixture(scope='function')
199-
def test_pdf_savefig_when_color_is_none(tempdir_factory):
200-
rcParams['_internal.classic_mode'] = False
201-
plt.subplot()
198+
@pytest.mark.style('default')
199+
def test_pdf_savefig_when_color_is_none(tmpdir):
200+
fig, ax = plt.subplots()
202201
plt.axis('off')
203-
plt.plot(np.sin(np.linspace(-5, 5, 100)), 'v', c='none')
204-
tmpdir_name = str(np.random.randint(100000, 10000000))
205-
actual_image = tempdir_factory.mktemp(tmpdir_name).join('figure.pdf')
206-
expected_image = tempdir_factory.mktemp(tmpdir_name).join('figure.eps')
207-
plt.savefig(str(actual_image), format='pdf')
208-
plt.savefig(str(expected_image), format='eps')
202+
ax.plot(np.sin(np.linspace(-5, 5, 100)), 'v', c='none')
203+
actual_image = tmpdir.join('figure.pdf')
204+
expected_image = tmpdir.join('figure.eps')
205+
fig.savefig(str(actual_image), format='pdf')
206+
fig.savefig(str(expected_image), format='eps')
209207
result = compare_images(str(actual_image), str(expected_image), 0)
210208
assert result is None

0 commit comments

Comments
 (0)