Commit Graph

36 Commits

Author SHA1 Message Date
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
a4bf9fa036 Convert most PillowTestCase methods to pytest 2020-02-02 12:26:01 +02:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Andrew Murray
1809f46e0b Do not calculate the crop width if it is already known 2019-09-29 14:26:32 +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
5631718a8d Format with Black 2019-06-13 18:54:46 +03:00
Andrew Murray
40bc46ff49 Moved ImageFile.Exif to Image.Exif 2019-04-01 20:03:02 +11:00
Andrew Murray
8f0db65cd7 Allow exif_transpose to work on Image instances as well as ImageFile 2019-04-01 19:37:25 +11:00
Andrew Murray
38fb9b1030 Delete EXIF orientation tag after transposing 2019-04-01 18:49:09 +11:00
Andrew Murray
1ba774ae7f Added ImageOps exif_transpose method 2019-03-04 11:49:39 +11: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
6dd0e48d9a Missing whitespace 2018-09-27 19:43:39 +10:00
Andrew Murray
9ee467d843 Too many blank lines 2018-09-27 19:42:23 +10:00
Andrew Murray
b09b43d8b2 Added ImageOps pad method 2018-09-26 20:07:46 +10:00
tsennott
50d6611587 moved tuple test to assert method in PillowTestCase; added docs 2018-07-09 07:04:48 -07:00
tsennott
1eed17c70e tightened up colorize(); split tests; moved tuple comparison fcn to helper.py 2018-07-08 20:09:39 -07:00
tsennott
4a6ec5ca72 updated colorize to allow optional black/white positions; enhanced tests 2018-07-07 18:19:26 -07:00
tsennott
837d868333 updated test to assert equality with reference images 2018-07-07 02:40:25 -07:00
tsennott
adf570a77e adding tests, updated docstring and comments 2018-07-06 18:42:16 -07:00
Andrew Murray
572a3d970c Removed whitespace from blank lines 2016-09-03 12:23:42 +10:00
wiredfool
ffa18c8efd Merge pull request #2011 from vlmath/master
Add ImageOps.scale to expand or contract a PIL image by a factor
2016-08-06 22:19:50 +01:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +03:00
Marco De Donno
f19c52b5d5 Code style update 2016-07-06 10:21:00 +02:00
Marco De Donno
7d8fea012b Code style update 2016-07-06 01:32:16 +02:00
Marco De Donno
4d51a410d8 Add the test for factor = 1 and -1 2016-07-05 20:46:47 +02:00
Marco De Donno
7af3c4c3bc Add test for the ImageOps.scale function 2016-07-05 20:15:14 +02:00
Andrew Murray
3c7e37d2d7 Replaced old-style classes 2015-05-27 00:07:21 +10:00
hugovk
8dad2b0c63 Replace some lena() with hopper(), and temporarily disable fail-fast so we can see all failures 2014-09-05 13:03:56 +03:00
hugovk
cf04a9a0d2 Remove unused tearDownModule 2014-07-07 20:03:50 +03:00
hugovk
3ec505958e Convert old tests to use unittest 2014-06-10 12:10:47 +03:00
Chris Bailey
08d0ec1e93 Generalizing pterk's ZeroDivisionError fix for 1px images 2013-07-01 12:36:46 +01:00
Peter van Kampen
ad0a96c3fa add test & comment 2013-06-23 15:22:31 +02:00
Brian Crowell
ad784eb808 py3k: Import Christoph Gohlke's test suite
This is Christoph Gohlke's test suite from his personal PIL package found
at http://www.lfd.uci.edu/~gohlke/pythonlibs/.

This is just to bring it in as a separate commit. Future commits will align
it with Pillow.
2013-01-10 08:46:39 -06:00