Commit Graph

72 Commits

Author SHA1 Message Date
Andrew Murray
ebbdc6ee6f
Merge branch 'main' into progress 2024-09-26 20:24:54 +10:00
Andrew Murray
38458a204c Corrected type hints 2024-07-20 19:07:42 +10:00
Andrew Murray
8b4b7ce7dd
Merge branch 'main' into progress 2024-07-16 20:05:10 +10:00
Andrew Murray
8a05e32336 Added type hints 2024-07-08 20:09:45 +10:00
Andrew Murray
2f27173d8f
Merge branch 'main' into progress 2024-06-26 18:45:50 +10:00
Andrew Murray
b15ce5a4bc Do not detect Ultra HDR images as MPO 2024-05-13 21:51:16 +10:00
Andrew Murray
d52b3a2ce1
Merge branch 'main' into progress 2024-04-02 09:16:02 +11:00
Andrew Murray
a78ed9595f Determine size from markers, not EXIF data 2024-03-16 18:40:16 +11:00
Andrew Murray
14560e1770
Merge branch 'main' into progress 2024-03-12 08:24:49 +11:00
Andrew Murray
6d78d42769 Added type hints 2024-03-02 13:12:17 +11:00
Andrew Murray
b7a5b5984b Updated tests for os.path.realpath 2024-02-12 19:24:01 +11:00
Andrew Murray
3c80ec0873
Merge branch 'main' into progress 2024-02-11 21:55:54 +11:00
Andrew Murray
344c300597
Merge branch 'main' into progress 2024-01-31 22:00:55 +11:00
Andrew Murray
bb1fece57a Added type hints 2024-01-31 21:55:32 +11:00
Hugo van Kemenade
4a4b90c365
Autotype tests (#7756)
* autotyping: --none-return
* autotyping: --scalar-return
* autotyping: --int-param
* autotyping: --float-param
* autotyping: --str-param
* autotyping: --annotate-named-param tmp_path:pathlib.Path
2024-01-31 20:12:58 +11:00
Andrew Murray
69680db24d Merge branch 'main' into progress 2024-01-21 14:44:29 +11:00
Hugo van Kemenade
53c3cd9f8e isort Tests 2024-01-20 13:23:03 +02:00
Andrew Murray
19c2721931
Merge branch 'main' into progress 2023-12-22 23:56:40 +11:00
Hugo van Kemenade
43b2f61e79 Add 'from __future__ import annotations' using Ruff/isort 2023-12-21 13:13:31 +02:00
Andrew Murray
fe7c9d37c8 Moved progress code into common private method 2023-10-06 19:45:21 +11:00
Andrew Murray
b5f322831a Restored filename in progress callback 2023-10-05 18:40:01 +11:00
Andrew Murray
3465a598e2 Pass back index of image in sequence, instead of filename 2023-10-02 18:33:48 +11:00
Andrew Murray
6850465d54 Added progress callback when save_all is used 2023-10-02 15:44:43 +11:00
Andrew Murray
9ed8ca1494 Removed "del im" 2023-03-03 10:28:36 +02:00
Aarni Koskela
43128ce716 Fix up pytest.warns lambda: uses 2023-02-23 16:06:40 +02:00
Hugo van Kemenade
8d5eb71d26 Use enumerate 2023-01-08 13:47:46 +02:00
Andrew Murray
9898613c4d Fixed saving EXIF data to MPO 2022-12-22 15:31:36 +11:00
Andrew Murray
af317a696d Added MP Format Version when saving 2022-11-13 08:00:20 +11:00
Andrew Murray
0ed03d4a58 Parametrize tests 2022-08-23 21:41:32 +10:00
Andrew Murray
2944ff18d6 Support saving multiple MPO frames 2022-07-16 20:02:58 +10:00
Andrew Murray
b1885779a9 Once exif data is parsed, do not reload unless it changes 2022-05-27 07:54:54 +10:00
Andrew Murray
e62449f94c Added DeferredError to _fp 2022-04-17 12:14:53 +10:00
Hugo van Kemenade
d3c9a6504e Variable in function should be snake_case 2022-04-10 23:55:16 +03:00
Andrew Murray
573cf278f1 Reset size when seeking away from "Large Thumbnail" MPO frame 2022-03-01 19:10:10 +11:00
Andrew Murray
dae1f691c2 Updated checks that no warnings were raised 2022-02-21 13:49:01 +11:00
Hugo van Kemenade
95986f38da
Merge pull request #5168 from radarhere/mpo 2021-03-07 11:38:36 +02:00
Andrew Murray
4a0569e97f Changed zero length assertions to falsy 2021-02-11 13:48:31 +11:00
Andrew Murray
01be700081 Fixed asserting that no warnings were raised 2021-02-10 23:37:55 +11:00
Andrew Murray
db3b5108dc Changed MP Type to match #1631 image 2021-01-01 13:00:01 +11:00
Andrew Murray
6175389186 Only read different sizes for "Large Thumbnail" frames 2021-01-01 12:45:02 +11:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03: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
Hugo
affade7595 Replace unittest with pytest 2020-02-13 12:15:05 +02:00
Hugo
38bf862185 Replace PillowTestCase.assert_warning with pytest.warns 2020-02-03 11:11:32 +02:00
Hugo
a4bf9fa036 Convert most PillowTestCase methods to pytest 2020-02-02 12:26:01 +02:00
Andrew Murray
47b2ae9a63 Raise a specific exception if no data is found for an MPO frame 2019-11-30 11:05:36 +11: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
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
f87821e010 Format with Black 2019-06-13 18:54:11 +03:00
Andrew Murray
64910d1921 Parse Nintendo and Fujifilm MakerNote tags 2019-03-28 21:13:12 +11:00