Commit Graph

45 Commits

Author SHA1 Message Date
Andrew Murray
afbf45055a Always raise warnings for deprecated feature checks 2024-10-11 20:59:15 +11:00
Andrew Murray
359d7592c7 Test deprecation warnings 2024-08-14 18:41:39 +10:00
Aleksandr Karpinskii
56ca359c65 Bring back removed features, add deprecations and Release notes 2024-08-13 09:34:49 +04:00
Aleksandr Karpinskii
a3468996c0 Remove webp animations flags and conditions
Removed:
_webp.WebPDecode
_webp.HAVE_WEBPANIM
features.webp_anim
2024-08-13 09:33:20 +04:00
Aleksandr Karpinskii
9bed5b4264 Remove _webp.WebPDecoderBuggyAlpha and _webp.HAVE_TRANSPARENCY 2024-08-13 09:26:04 +04:00
Aleksandr Karpinskii
c1e8375af8 Require webpmux and webpdemux 2024-08-13 09:24:52 +04:00
Andrew Murray
8e8ee1e4c4 Accept 't' suffix for libtiff version 2024-06-10 17:38:17 +10:00
Andrew Murray
923d4e5e1a Added type hints 2024-06-05 22:27:23 +10:00
Andrew Murray
e68cec640a Added type hints 2024-05-30 12:00:50 +10:00
Andrew Murray
4af831e70c Accept '.zlib-ng' suffix to zlib version 2024-04-24 23:45:25 +10:00
Nulano
e5a46ef45d add test for --report argument and features.pilinfo(supported_formats) 2024-03-09 14:58:05 +01:00
Nulano
ab9dfd8181 Add sys.{executable,base_prefix,prefix} to features.pilinfo 2024-02-20 21:38:04 +01:00
Andrew Murray
5ff7d926fd Added type hints 2024-02-17 15:00:38 +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
Hugo van Kemenade
53c3cd9f8e isort Tests 2024-01-20 13:23:03 +02:00
Hugo van Kemenade
43b2f61e79 Add 'from __future__ import annotations' using Ruff/isort 2023-12-21 13:13:31 +02:00
Andrew Murray
c259ac492f Parametrized tests 2022-10-03 16:57:42 +11:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03:00
nulano
d5a6b2584e add tests for version numbers 2020-06-21 18:59:01 +10:00
Hugo van Kemenade
974233be45
Merge pull request #4438 from jdufresne/warning
Warn on typos passed to features.check()
2020-03-02 21:26:17 +02:00
Jon Dufresne
c057ad1535 Warn on typos passed to features.check()
If the feature isn't one of the recognized types, a UserWarning is
emitted.
2020-02-18 19:48:48 -08: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
Andrew Murray
7fd9663198 Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
Jon Dufresne
33dabf986f Import unittest from stdlib rather than helper.py
The unittest in helper.py has not offered an interesting abstraction
since dbe9f85c7d so import from the more
typical stdlib location.
2019-11-20 18:42:52 -08:00
Hugo van Kemenade
5006401d0b
Merge branch 'master' into rm-2.7 2019-11-03 22:48:26 +02:00
nulano
accbe58b5e add Python version to selftest, rename brief parameter 2019-10-12 15:40:12 +01:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03: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
Andrew Murray
68fac40147 Fixed black formatting 2019-06-22 14:47:56 +10:00
Hugo
f5cd8b4b0d
Merge pull request #3909 from hugovk/run-black
Format code with Black
2019-06-22 06:46:15 +03:00
Hugo
d08475442b Format with Black 2019-06-13 18:53:42 +03:00
Jon Dufresne
1008644dd6 Add __main__.py to output basic format and support information
To help debug and show supported formats, users can run:

    $ python -m PIL

to get basic format and support information about the installed version
of Pillow.

The new feature works as follows:

    $ python -m PIL
    --------------------------------------------------------------------
    Pillow 6.1.0.dev0
    --------------------------------------------------------------------
    Python modules loaded from .../Pillow/src/PIL
    Binary modules loaded from .../Pillow/src/PIL
    --------------------------------------------------------------------
    Python 3.7.3 (default, May 11 2019, 00:38:04)
           [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
    --------------------------------------------------------------------
    --- PIL CORE support ok
    --- TKINTER support ok
    --- FREETYPE2 support ok
    --- LITTLECMS2 support ok
    --- WEBP support ok
    --- WEBP Transparency support ok
    --- WEBPMUX support ok
    --- WEBP Animation support ok
    --- JPEG support ok
    --- OPENJPEG (JPEG2000) support ok
    --- ZLIB (PNG/ZIP) support ok
    --- LIBTIFF support ok
    --- RAQM (Bidirectional Text) support ok
    --------------------------------------------------------------------
    BLP
    Extensions: .blp
    Features: open
    --------------------------------------------------------------------
    BMP image/bmp
    Extensions: .bmp
    Features: open, save
    --------------------------------------------------------------------
    BUFR
    Extensions: .bufr
    Features: open, save
    --------------------------------------------------------------------
    …
2019-05-27 18:44:04 -07:00
Jon Dufresne
4de5477b61 Remove unnecessary unittest.main() boilerplate from test files
With the introduction and use of pytest, it is simple and easy to
execute specific tests in isolation through documented command line
arguments. Either by specifying the module path or through the `-k
EXPRESSION` argument. There is no longer any need to provide the
boilerplate:

    if __name__ == '__main__':
        unittest.main()

To every test file. It is simply noise.

The pattern remains in test files that aren't named with `test_*` as
those files are not discovered and executed by pytest by default.
2019-02-03 10:10:16 -08:00
Jon Dufresne
7da17ad41e Improve pytest configuration to allow specific tests as CLI args
The previous test configuration made it difficult to run a single test
with the pytest CLI. There were two major issues:

- The Tests directory was not a package. It now includes a __init__.py
  file and imports from other tests modules are done with relative
  imports.

- setup.cfg always specified the Tests directory. So even if a specific
  test were specified as a CLI arg, this configuration would also always
  include all tests. This configuration has been removed to allow
  specifying a single test on the command line.

Contributors can now run specific tests with a single command such as:

  $ tox -e py37 -- Tests/test_file_pdf.py::TestFilePdf.test_rgb

This makes it easy and faster to iterate on a single test failure and is
very familiar to those that have previously used tox and pytest.

When running tox or pytest with no arguments, they still discover and
runs all tests in the Tests directory.
2019-01-13 09:00:12 -08:00
Hugo
fc3a159c87 More specific exception clause 2018-10-24 22:29:01 +03:00
Hugo
cfc4c3e101 Switch check_ to test_ to enable them 2018-10-21 16:44:12 +03:00
Hugo
a1b9f94d60 skipUnless takes a condition and _reason_ 2018-10-21 16:42:41 +03:00
Jason Douglas
c18d26b04b - Conditonally compile animation support, only if the mux.h and demux.h headers meet the ABI version requirements
- Add WEBPMUX support back to WebPDecode_wrapper (to support older versions of libwebp that have mux support, but not animation)
- Add HAVE_WEBPANIM flag, and use it appropriately
- Update documentation / tests
2017-09-27 19:04:24 -07:00
Andrew Murray
9e843a2d9b Changed format of lambda calls 2017-09-01 21:05:40 +10:00
Eric Soroos
3293d6a1c5 tests for features 2017-06-13 04:38:26 -07:00
Andrew Murray
e8cba27bb1 Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
Jon Dufresne
e44bb42ae9 Replace type() equality checks with isinstance 2016-10-31 06:41:43 -07:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +03:00
hugovk
05987c8d60 Test unsupported features 2015-05-15 11:42:36 +03:00
Andrew Murray
3458e7a4c3 Added feature checking tests 2015-05-15 07:33:17 +10:00