Commit Graph

34 Commits

Author SHA1 Message Date
Andrew Murray
4ce06aac3b Added type hints 2024-02-12 23:01:44 +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
45c9dcf123 Restored 32-bit support 2023-06-27 14:43:58 +10:00
Andrew Murray
d6f19625e8 Removed support for 32-bit 2023-06-23 21:52:00 +10:00
Aarni Koskela
912ab3e088
Apply suggestions from code review
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2023-03-03 16:00:56 +02:00
Aarni Koskela
44c4e67fe1
Fix vars to var
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-02-24 09:26:18 +02:00
Aarni Koskela
43128ce716 Fix up pytest.warns lambda: uses 2023-02-23 16:06:40 +02:00
Andrew Murray
72b7ab54bd pre-commit autoupdate --freeze 2022-03-04 16:42:24 +11:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03:00
Hugo
2cc6a9a974 Convert to use pytest 2020-03-02 16:31:08 +02:00
Andrew Murray
8482919a37 Converted most assert statements to pytest 2020-02-23 00:06:21 +11:00
Hugo
38bf862185 Replace PillowTestCase.assert_warning with pytest.warns 2020-02-03 11:11:32 +02:00
Jon Dufresne
2c50723f14 Convert some tests to pytest style
To better follow conventional pytest style, this removes the outer
wrapper class in favor of a function for some tests. These tests were
picked as they are relatively simple and presented no barriers to a
quick port. The assert* methods are replaced with assert statements.
When necessary, a fixture is used to create a temporary directory.

This commit does not convert the entire test suite to this style as some
test classes use methods or other advanced features that are difficult
to automatically convert. The goal is to address these issues in
followup commits.

Refs #4193
2020-01-18 12:12:10 -08: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
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7 2019-10-12 18:03:58 +11:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
nulano
cf1f8b0498 Tests.helper cleanup 2019-09-25 11:58:02 +02: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
f22198e3bc Lint fixes 2019-06-26 19:09:02 +10:00
Andrew Murray
d591cf8d3f Error is not raised on 64-bit systems 2019-06-26 19:08:07 +10:00
Jayakrishna Menon
590b5b7f9e test case for set_blocks_max 2019-06-26 19:08:07 +10:00
Hugo
d08475442b Format with Black 2019-06-13 18:53:42 +03: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
Andrew Murray
3ff4b54050 Added __main__ code 2018-11-12 19:54:26 +11:00
Alexander
4b85230726 clear_cache: number or blocks to keep 2017-09-23 04:20:53 +03:00
Alexander
654b5f7958 tests for env vars 2017-09-19 01:00:18 +03:00
Alexander
44c2698f69 ImagingMemoryBlock structure 2017-09-18 22:48:32 +03:00
Alexander
2ab19bbe44 actually fix tests on pypy 2017-09-18 03:17:45 +03:00
Alexander
23527774d3 test for images wider than block_size 2017-09-18 02:57:14 +03:00
Alexander
ae104b0d0e collect garbage before check memory 2017-09-18 02:51:27 +03:00
Alexander
6d2be876c8 tests 2017-09-18 02:37:47 +03:00