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

Skip to content

Don't leak test.jpeg into cwd while testing. #9486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/matplotlib/tests/test_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ def test_chunksize():

@pytest.mark.backend('Agg')
def test_jpeg_dpi():
try:
from PIL import Image
except Exception:
pytest.skip("Could not import PIL")
# Check that dpi is set correctly in jpg files
Image = pytest.importorskip("PIL.Image")
# Check that dpi is set correctly in jpg files.
plt.plot([0, 1, 2], [0, 1, 0])
plt.savefig('test.jpg', dpi=200)
im = Image.open("test.jpg")
buf = io.BytesIO()
plt.savefig(buf, format="jpg", dpi=200)
im = Image.open(buf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not remember details, but from my previous experience this should not work without a buf.seek(0) call.
However CI is fine...

assert im.info['dpi'] == (200, 200)