matplotlib / matplotlib/pytest-mpl
default savefig format
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 272
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
In the process of penning #150, I noticed that when capturing the test image to an io.Bytes in-memory buffer:
That the format kwarg to savefig isn't used.
Would you be adverse to defaulting to format='png', particularly when writing to a buffer, as (from what I understand) matplotlib will default to the rcParams to select the file-format to save to the buffer for the image, and this could be a source confusion/issues for hashing repeatability for developers when testing.
i.e., what I'm proposing is that a format='png' is injected into the savefig_kwargs, iff not specified by the caller as a kwarg option in the marker decorator.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pytest_mpl/plugin.py at the linked savefig call around lines 419–421, then trace how savefig_kwargs comes from the marker decorator. Check how the in-memory buffer is handled and verify that the default format is PNG while a caller-provided format remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100