Commit Graph

171 Commits

Author SHA1 Message Date
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
Andrew Murray
6cd99fc3cf
Merge branch 'master' into rm-2.7 2019-10-08 18:57:27 +11:00
Jon Dufresne
64032061c0 Move several imports to the top-level of the file
This better follows PEP 8 style guide:

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.

This also avoids duplicate import code within the same file.
2019-10-07 06:28:36 -07:00
Hugo
74d2767c57 Remove duplicate line 2019-10-07 14:30:59 +03:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00
Andrew Murray
fb8470187a
Merge pull request #4034 from cgohlke/patch-1
Initialize rows_per_strip when RowsPerStrip tag is missing
2019-09-30 22:32:34 +10:00
Andrew Murray
4de10089f0 Moved libtiff test into libtiff test file 2019-09-29 21:06:11 +10:00
Hugo van Kemenade
f5aed1a254
Merge branch 'master' into patch-1 2019-09-20 22:59:29 +03:00
Andrew Murray
19ab3c36e6 Added test 2019-09-18 22:07:17 +10:00
Andrew Murray
1b70a4c6b5 Use TIFF orientation 2019-09-13 22:36:26 +10:00
chadawagner
34330a7aa0
Update Tests/test_file_libtiff.py
Co-Authored-By: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2019-08-19 09:46:07 -07:00
chadawagner
457a97dde8 added test for reading TIFF from non-disk file obj 2019-08-12 18:56:34 +10:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.

Uses the configuration recommended by the Black to avoid conflicts of
style.

Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
Hugo
f5a89a0e9a Use unittest asserts for consistency 2019-06-30 11:13:02 +03:00