Commit Graph

185 Commits

Author SHA1 Message Date
Andrew Murray
7d4a8668b1 Block tile TIFF tags when saving 2021-11-18 22:01:53 +11:00
pre-commit-ci[bot]
dbb0a41600 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-10-13 21:10:23 +00:00
Andrew Murray
1140f6538d
Ensure reset after test failure
Co-authored-by: Ondrej Baranovič <nulano@nulano.eu>
2021-10-14 08:09:36 +11:00
Andrew Murray
0b7fcbbc93
Merge branch 'master' into patch-2 2021-10-13 23:50:23 +11:00
Andrew Murray
b5d6a73da9 Added test 2021-10-13 11:39:31 +02:00
Andrew Murray
8de429ecb9 Fixed Python errors when saving a (0, 0) TIFF image 2021-10-08 13:12:21 +11:00
Andrew Murray
98aa0f10ad pre-commit autoupdate --freeze 2021-08-12 21:50:09 +10:00
Hugo van Kemenade
4e4d580dfd
Merge pull request #5597 from radarhere/ycbcr_tiff
Added tags when saving YCbCr TIFF
2021-07-28 13:08:54 +03:00
Andrew Murray
5cdcc2cf64 Added tags when saving YCbCr TIFF 2021-07-10 01:20:36 +10:00
Andrew Murray
abb192c9b3 Added test 2021-07-07 11:34:15 +02:00
Miloš Komarčević
100299a838 Add multiple strip saving test 2021-06-12 11:49:20 +10:00
Hugo van Kemenade
f02739715d
Merge pull request #5452 from radarhere/missing_samplesperpixel
Updated default value for SAMPLESPERPIXEL TIFF tag
2021-05-14 16:17:34 +03:00
Andrew Murray
6fc039a21c Updated default value for SAMPLESPERPIXEL tag 2021-05-04 16:50:12 +10:00
Andrew Murray
fd299e36ce Reset handle when seeking backwards as well 2021-04-29 22:47:20 +10:00
Eric Soroos
1c872a9eda lint stuff 2021-04-10 16:58:01 +02:00
Eric Soroos
a3a69c8385 conditional mark for valgrind ignore 2021-04-09 23:53:24 +02:00
Konstantin Kopachev
4c2dfadf26 Swap pixel values on Big Endian 2021-03-28 15:03:37 +02:00
Konstantin Kopachev
169bb4842f only use TIFFReadRGBA* in case of o_jpeg compression 2021-03-28 15:03:37 +02:00
nulano
671837840a the previous commit also fixes these big-endian failures 2021-03-28 15:03:37 +02:00
Konstantin Kopachev
0018685a8e Add Tests and support for Planar Tiff Images 2021-03-28 15:03:37 +02:00
Andrew Murray
298600381f Replaced tiff_deflate with tiff_adobe_deflate compression when saving 2021-03-19 12:00:29 +11:00
Andrew Murray
3495b319bd Replaced various instances of assert_image_similar with assert_image_similar_tofile 2021-02-21 22:22:29 +11:00
Andrew Murray
a5c251029c Replaced various instances of assert_image_equal with assert_image_equal_tofile 2021-02-21 22:15:56 +11:00
Andrew Murray
eb7e5d2797 Moved test that requires libtiff 2021-01-29 08:00:37 +11:00
Eric Soroos
1d7c8e03d0 known failing tests from valgrind -- uninitialized values 2021-01-07 14:52:02 +01:00
Andrew Murray
59ee809f13 Updated capitalisation
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-01-07 14:52:02 +01:00
Eric Soroos
bd38487324 Ignore this test in valgrind -- the metadata values don't make logical sense. 2021-01-07 14:52:02 +01:00
nulano
989c9b303a xfail failing libtiff tests on big-endian
(cherry picked from commit 25ce233edf732edb5660f877365379377a64f136)
2020-12-12 15:26:42 +01:00
Hugo van Kemenade
e0eec1eb56 Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
Hugo van Kemenade
10615a7da7 Upgrade Python syntax for 3.6+
Co-authored-by: nulano <nulano@nulano.eu>
2020-07-30 10:09:18 +03:00
Hugo van Kemenade
7dd8837967
Merge pull request #4647 from radarhere/blocklist
Allow libtiff to write COLORMAP tag
2020-06-25 23:04:29 +03:00
nulano
d5a6b2584e add tests for version numbers 2020-06-21 18:59:01 +10:00
Hugo van Kemenade
2d9dcc7657
Merge pull request #4627 from radarhere/tiff_jpeg
Replaced tiff_jpeg with jpeg compression when saving TIFF images
2020-06-20 15:49:09 +03:00
Andrew Murray
d728cd5875 Allow libtiff to write COLORMAP tag 2020-06-20 22:38:38 +10:00
Andrew Murray
2d284aea12 Allow writing of UNDEFINED tags 2020-06-10 16:09:22 +10:00
Andrew Murray
859b27572b Removed forcing of BYTE to ASCII 2020-06-10 16:09:22 +10:00
Andrew Murray
aa1761bc9f Replace tiff_jpeg with jpeg compression when saving 2020-05-15 22:37:13 +10:00
Hugo
dda6145fce Since Python 3.3 IOError and WindowsError have been merged into OSError 2020-04-10 12:57:29 +03:00
Hugo
2cc6a9a974 Convert to use pytest 2020-03-02 16:31:08 +02:00
Hugo
699a9dadf1 Convert asserts 2020-02-22 18:07:04 +02:00
Andrew Murray
8482919a37 Converted most assert statements to pytest 2020-02-23 00:06:21 +11:00
Jon Dufresne
4f185329f4 Streamline test skipping based on supported features
This adds a new test decorator: skip_unless_feature(). The argument is
the same as passed to features.check(). If the feature is not supported,
the test will be skipped.

This removes several kinds of boilerplate copied and pasted around tests
so test feature checking is handled and displayed more consistently.

Refs #4193
2020-02-18 13:07:01 -08:00
Jon Dufresne
98a2081a78 Move safe imports to the top of test files
These modules are safe to import and this better follows PEP 8.

From https://www.python.org/dev/peps/pep-0008/#imports

> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
2020-02-17 10:49:27 -08:00
Hugo
a4bf9fa036 Convert most PillowTestCase methods to pytest 2020-02-02 12:26:01 +02:00
Andrew Murray
b9c68540dc Overflow checks for realloc for tiff decoding 2020-01-02 15:24:46 +11:00
Andrew Murray
f77c409742 Renamed variable 2019-12-31 09:04:25 +11:00
Andrew Murray
34d04d3e82 Replaced distutils with C version check 2019-12-28 09:57:49 +11:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Hugo
cc63f66575 Merge remote-tracking branch 'upstream/master' into rm-2.7 2019-11-01 13:22:56 +02:00
Jon Dufresne
4cd4adddc3 Improve handling of file resources
Follow Python's file object semantics. User code is responsible for
closing resources (usually through a context manager) in a deterministic
way.

To achieve this, remove __del__ functions. These functions used to
closed open file handlers in an attempt to silence Python
ResourceWarnings. However, using __del__ has the following drawbacks:

- __del__ isn't called until the object's reference count reaches 0.
  Therefore, resource handlers remain open or in use longer than
  necessary.

- The __del__ method isn't guaranteed to execute on system exit. See the
  Python documentation:

  https://docs.python.org/3/reference/datamodel.html#object.__del__

  > It is not guaranteed that __del__() methods are called for objects
  > that still exist when the interpreter exits.

- Exceptions that occur inside __del__ are ignored instead of raised.
  This has the potential of hiding bugs. This is also in the Python
  documentation:

  > Warning: Due to the precarious circumstances under which __del__()
  > methods are invoked, exceptions that occur during their execution
  > are ignored, and a warning is printed to sys.stderr instead.

Instead, always close resource handlers when they are no longer in use.
This will close the file handler at a specified point in the user's code
and not wait until the interpreter chooses to. It is always guaranteed
to run. And, if an exception occurs while closing the file handler, the
bug will not be ignored.

Now, when code receives a ResourceWarning, it will highlight an area
that is mishandling resources. It should not simply be silenced, but
fixed by closing resources with a context manager.

All warnings that were emitted during tests have been cleaned up. To
enable warnings, I passed the `-Wa` CLI option to Python. This exposed
some mishandling of resources in ImageFile.__init__() and
SpiderImagePlugin.loadImageSeries(), they too were fixed.
2019-10-12 08:27:17 -07:00