mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Merge pull request #4390 from jdufresne/resource-warning
Fix ResourceWarning emitted during tests
This commit is contained in:
commit
098406c304
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
python -m pytest -v -x --cov PIL --cov Tests --cov-report term Tests
|
python -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests
|
||||||
|
|
||||||
# Docs
|
# Docs
|
||||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
|
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
|
||||||
|
|
2
.github/workflows/test-windows.yml
vendored
2
.github/workflows/test-windows.yml
vendored
|
@ -335,7 +335,7 @@ jobs:
|
||||||
rem Add libraqm.dll (copied to INCLIB) to PATH.
|
rem Add libraqm.dll (copied to INCLIB) to PATH.
|
||||||
path %INCLIB%;%PATH%
|
path %INCLIB%;%PATH%
|
||||||
cd /D %GITHUB_WORKSPACE%
|
cd /D %GITHUB_WORKSPACE%
|
||||||
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
|
%PYTHON%\python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
||||||
- name: Prepare to upload errors
|
- name: Prepare to upload errors
|
||||||
|
|
|
@ -644,7 +644,7 @@ class TestFileJpeg(PillowTestCase):
|
||||||
|
|
||||||
def test_invalid_exif_x_resolution(self):
|
def test_invalid_exif_x_resolution(self):
|
||||||
# When no x or y resolution is defined in EXIF
|
# When no x or y resolution is defined in EXIF
|
||||||
im = Image.open("Tests/images/invalid-exif-without-x-resolution.jpg")
|
with Image.open("Tests/images/invalid-exif-without-x-resolution.jpg") as im:
|
||||||
|
|
||||||
# This should return the default, and not a ValueError or
|
# This should return the default, and not a ValueError or
|
||||||
# OSError for an unidentified image.
|
# OSError for an unidentified image.
|
||||||
|
|
|
@ -232,7 +232,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(max_long, reloaded.tag_v2[41493].numerator)
|
self.assertEqual(max_long, reloaded.tag_v2[41493].numerator)
|
||||||
self.assertEqual(1, reloaded.tag_v2[41493].denominator)
|
self.assertEqual(1, reloaded.tag_v2[41493].denominator)
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(max_long, reloaded.tag_v2[41493].numerator)
|
self.assertEqual(max_long, reloaded.tag_v2[41493].numerator)
|
||||||
self.assertEqual(1, reloaded.tag_v2[41493].denominator)
|
self.assertEqual(1, reloaded.tag_v2[41493].denominator)
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(numerator, reloaded.tag_v2[37380].numerator)
|
self.assertEqual(numerator, reloaded.tag_v2[37380].numerator)
|
||||||
self.assertEqual(denominator, reloaded.tag_v2[37380].denominator)
|
self.assertEqual(denominator, reloaded.tag_v2[37380].denominator)
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(numerator, reloaded.tag_v2[37380].numerator)
|
self.assertEqual(numerator, reloaded.tag_v2[37380].numerator)
|
||||||
self.assertEqual(denominator, reloaded.tag_v2[37380].denominator)
|
self.assertEqual(denominator, reloaded.tag_v2[37380].denominator)
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(2 ** 31 - 1, reloaded.tag_v2[37380].numerator)
|
self.assertEqual(2 ** 31 - 1, reloaded.tag_v2[37380].numerator)
|
||||||
self.assertEqual(-1, reloaded.tag_v2[37380].denominator)
|
self.assertEqual(-1, reloaded.tag_v2[37380].denominator)
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class TestFileTiffMetadata(PillowTestCase):
|
||||||
out = self.tempfile("temp.tiff")
|
out = self.tempfile("temp.tiff")
|
||||||
im.save(out, tiffinfo=info, compression="raw")
|
im.save(out, tiffinfo=info, compression="raw")
|
||||||
|
|
||||||
reloaded = Image.open(out)
|
with Image.open(out) as reloaded:
|
||||||
self.assertEqual(reloaded.tag_v2[37000], -60000)
|
self.assertEqual(reloaded.tag_v2[37000], -60000)
|
||||||
|
|
||||||
def test_empty_values(self):
|
def test_empty_values(self):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -14,7 +14,7 @@ commands =
|
||||||
{envpython} setup.py clean
|
{envpython} setup.py clean
|
||||||
{envpython} setup.py build_ext --inplace
|
{envpython} setup.py build_ext --inplace
|
||||||
{envpython} selftest.py
|
{envpython} selftest.py
|
||||||
{envpython} -m pytest {posargs}
|
{envpython} -m pytest -W always {posargs}
|
||||||
deps =
|
deps =
|
||||||
cffi
|
cffi
|
||||||
numpy
|
numpy
|
||||||
|
|
Loading…
Reference in New Issue
Block a user