Ensure file is closed if it is opened by ImageQt.ImageQt#5260
Ensure file is closed if it is opened by ImageQt.ImageQt#5260hugovk merged 1 commit intopython-pillow:masterfrom
Conversation
4fc4f6d to
a447e92
Compare
a447e92 to
254973f
Compare
| with pytest.warns(None) as record: | ||
| ImageQt.ImageQt("Tests/images/hopper.gif") | ||
|
|
||
| assert not record |
There was a problem hiding this comment.
Do you know why this is missing coverage? We should have some Qt at least on some CI?
(Similarly for #5260)
There was a problem hiding this comment.
It looks like Codecov only received AppVeyor coverage for this PR: https://codecov.io/gh/python-pillow/Pillow/commit/254973f8a035275c342e408e6ec883e5b2d2ee47/build
There is PyQt5 in the Arch container (among others), its coverage is reported here: https://codecov.io/github/python-pillow/Pillow/commit/d5f5ae68a8f758e53188903a01f43f693bff3220
There are some errors reported:
==> GitHub Actions detected.
-> Issue detecting commit SHA. Please run actions/checkout with fetch-depth > 1 or set to 0
project root: .
Yaml found at: codecov.yml
-> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20210129-7c25fce&token=secret&branch=imageqt_exclusive_fp&commit=d5f5ae68a8f758e53188903a01f43f693bff3220&build=580803277&build_url=http%3A%2F%2Fgithub.com%2Fpython-pillow%2FPillow%2Factions%2Fruns%2F580803277&name=ubuntu-latest%20Python%203.9&tag=&slug=python-pillow%2FPillow&service=github-actions&flags=GHA_Ubuntu&pr=5260&job=Test&cmd_args=F
{'detail': ErrorDetail(string='Actions workflow run is stale', code='not_found')}
404
There was a problem hiding this comment.
Hmm. I tried rebasing in hopes of getting more reports, but I only got one more.
There was a problem hiding this comment.
Well we get some coverage here now: https://codecov.io/gh/python-pillow/Pillow/src/dc0db43d35b081ad5f0f6266be79c0355d284f3b/Tests/test_imageqt.py
and https://codecov.io/gh/python-pillow/Pillow/commit/dc0db43d35b081ad5f0f6266be79c0355d284f3b/build shows a load of GHA builds too. Good enough for this PR, let's keep an eye on Codecov... Thanks!
254973f to
e7f5bb1
Compare
If the
ImageQt.ImageQtclass is passed a path, it opens the file - but it doesn't close it withclose()or a context manager. This PR fixes that, closingimwithin_toqclass_helper._toqclass_helperpreviously returnedim, but only for so thatImageQt.ImageQtcould extract the size from it. So I've changed that to just return the size directly, and keepimwithin_toqclass_helper. This should be fine in terms of backwards compatibility, as the method is indicated to be for private use by the leading_.