Commit Graph

108 Commits

Author SHA1 Message Date
Andrew Murray
7859f81828 Use pytest to skip tests 2020-03-23 07:05:40 +11: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
1a3ebafdd2 Replace SimplePatcher with builtin unittest.mock module
The class more or less duplicates the features of the mock module. Can
avoid the duplication by using the stdlib.
2020-02-17 10:06:19 -08: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 van Kemenade
37be3b0dda
Merge pull request #4145 from nulano/ucs4-pypy
Fix Unicode support for PyPy
2019-11-24 13:51:27 +02: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
nulano
837d8ae984 fix support for extended unicode characters in PyPy 2019-11-20 17:02:44 +00:00
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7 2019-10-12 18:03:58 +11:00
Hugo
865b17d5cf Remove Python 2-compatibility code 2019-10-07 16:23:22 +03: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
Andrew Murray
f93a5d0972 Added text stroking 2019-07-29 06:40:03 +10:00
Hugo van Kemenade
1ab5670eb1
Introduce isort to automate import ordering and formatting (#3954)
Introduce isort to automate import ordering and formatting
2019-07-16 23:02:31 +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
nulano
0b0dc1112e Merge branch 'master' into revert-3931-update-freetype-epsilon
# Conflicts:
#	Tests/test_imagefont.py
2019-07-02 22:49:45 +02:00
nulano
d7c69ea2b4 skip test_unicode_extended on Python 2.x 2019-07-02 11:14:09 +02:00
nulano
22ce5cc0c7
Revert "Update epsilon for FreeType 2.10 with eg. Unicode width 16" 2019-07-02 11:08:48 +02:00
nulano
14ddfd30b2 fix lint 2019-07-02 09:31:05 +02:00
nulano
86d4c53d79 revert #3780 for PyPy as it hasn't been updated 2019-07-02 08:52:15 +02:00
Hugo
46535df8f3 Update epsilon for FreeType 2.10 with eg. Unicode width 16 2019-07-01 16:32:22 +03:00
Hugo
8d4bb339a6
Merge pull request #3780 from nulano/update_py_unicode
Update Py_UNICODE to Py_UCS4
2019-06-30 13:21:46 +03:00
Andrew Murray
25cf1010eb Lint fixes 2019-06-25 22:20:57 +10:00
nulano
983371d4d8 fix centos, amazon 2019-06-25 22:16:00 +10:00
nulano
be192d8f69 fix lint 2019-06-25 22:16:00 +10:00
nulano
5f65f10191 add test for #3777 2019-06-25 22:16:00 +10:00
Andrew Murray
7bb16de81c Fixed crash when loading non-font bytes 2019-06-23 11:53:01 +10: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
Andrew Murray
da16b7ec45 Added variation font support 2019-06-19 20:27:49 +10:00
Hugo
5631718a8d Format with Black 2019-06-13 18:54:46 +03:00
Andrew Murray
124c1f6bce Added tests 2019-05-04 23:05:41 +10:00
Andrew Murray
4e6aa7d6d3 Fixed loading font with non-Unicode path on Windows 2019-04-10 07:04:59 +10:00
Andrew Murray
15f8ef02c9 Updated freetype to 2.10.0 2019-03-22 21:14:39 +11:00
Ben Yang
9f390a5192 uncommented test 2019-03-11 18:56:22 -07:00
Ben Yang
5cdbec0cfe added test for attempting to apply complex settings to fonts when using basic layout engine 2019-03-11 18:56:22 -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
d7e4d3db3f Convert assert into exception 2018-08-25 19:06:11 +03:00
Andrew Murray
c2189235af Line too long 2018-07-02 19:26:02 +10:00
Andrew Murray
58cc23695d Continuation line over-indented for visual indent 2018-07-02 19:21:44 +10:00
Andrew Murray
e7815ccd62 Block comment should start with '# ' 2018-07-02 19:21:44 +10:00
Hugo
abae745da1
Merge pull request #3114 from tianyu139/hotfix
Fixed bug in ImageDraw.multiline_textsize()
2018-07-01 21:34:45 +03:00
Hugo
490464010a
Merge pull request #3113 from tianyu139/develop
Added getsize_multiline support for PIL.ImageFont
2018-07-01 21:33:21 +03:00
Hugo
40a0398657
Add spacing 2018-07-01 20:55:53 +03:00
Hugo
488161ebba
flake8 2018-07-01 20:54:12 +03:00
Hugo
67e5540021 Skip font tests when ImageFont not available 2018-05-31 15:11:50 +03:00
tianyu
58474d1c8d Added test to ensure ImageDraw.multiline_textsize returns same value as ImageFont.getsize for single lines 2018-04-24 22:55:17 +08:00