Commit Graph

9640 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
Jon Dufresne
f72e64b90b Remove unnecessary setup_module() from test_file_tar.py
The test_sanity() already checks the decorder exists and the other tests
can run without zlib/jpeg installed.
2020-02-18 13:02:30 -08:00
Jon Dufresne
967f46d1d8 Remove unnecessary skip test logic
The gif_encoder and gif_decoder are always compiled and included in
src/_imaging.c.
2020-02-18 13:02:30 -08:00
Hugo van Kemenade
2d4b4576aa
Merge pull request #4428 from jdufresne/use-mock
Replace SimplePatcher with builtin unittest.mock module
2020-02-18 16:08:28 +02:00
Hugo van Kemenade
8ec548d163
Merge pull request #4431 from jdufresne/top
Move safe imports to the top of test files
2020-02-17 22:34:57 +02:00
Hugo van Kemenade
9f2d478f03
Merge pull request #4429 from jdufresne/cpickle
Remove testing of Python-2-only cPickle module
2020-02-17 21:48:43 +02:00
Jon Dufresne
98a2081a78 Move safe imports to the top of test files
These modules are safe to import and this better follows PEP 8.

From https://www.python.org/dev/peps/pep-0008/#imports

> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
2020-02-17 10:49:27 -08:00
Jon Dufresne
9e856b8a72 Remove testing of Python-2-only cPickle module
In Python 3, cPickle and pickle have been merged to a single module.

From https://docs.python.org/3/whatsnew/3.0.html#library-changes

> A common pattern in Python 2.x is to have one version of a module
> implemented in pure Python, with an optional accelerated version
> implemented as a C extension; for example, pickle and cPickle. This
> places the burden of importing the accelerated version and falling
> back on the pure Python version on each user of these modules. In
> Python 3.0, the accelerated versions are considered implementation
> details of the pure Python versions. Users should always import the
> standard version, which attempts to import the accelerated version and
> falls back to the pure Python version. The pickle / cPickle pair
> received this treatment.

Can now move the 'import pickle' to the top of the test file.
2020-02-17 10:27:36 -08:00
Hugo van Kemenade
6bcc5bf150
Merge pull request #4427 from jdufresne/str
Remove redundant str() call
2020-02-17 20:16:12 +02: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
Jon Dufresne
6121daa72d Remove redundant str() call
The %s placeholder already coerces arguments to a string.
2020-02-17 09:18:49 -08:00
Hugo van Kemenade
53ece804c7
Merge pull request #4425 from radarhere/icns_fp
Fix saving bug in IcnsImagePlugin __main__
2020-02-17 13:59:27 +02:00
Andrew Murray
6e130e9f63 Close file pointer in __main__ 2020-02-17 22:12:46 +11:00
Andrew Murray
bd7242228b Fixed saving bug in __main__ 2020-02-17 22:11:24 +11:00
Andrew Murray
29fee8fc43
Merge pull request #4373 from radarhere/display_profile
get_display_profile is only supported on Windows
2020-02-16 21:02:23 +11:00
Andrew Murray
b0b3097018 Explicity return None
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-02-16 20:35:39 +11:00
Andrew Murray
466da649f5 get_display_profile is only supported on Windows 2020-02-16 20:35:39 +11:00
Hugo van Kemenade
a89156ab42
Merge pull request #4419 from hugovk/pytest
Convert some tests to pytest style
2020-02-16 09:08:44 +02:00
Hugo van Kemenade
e0d04b6a23
Merge pull request #41 from radarhere/pytest
Restored test
2020-02-16 08:30:15 +02:00
Andrew Murray
8e81e0dd0e Restored test 2020-02-16 13:44:34 +11:00
Andrew Murray
bfafc5ec1e Updated CHANGES.rst [ci skip] 2020-02-16 06:54:33 +11:00
Hugo
9087599e60 Merge remote-tracking branch 'upstream/master' into pytest 2020-02-15 16:56:21 +02:00
Hugo van Kemenade
852d9156bc
Remove commas
Co-Authored-By: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2020-02-15 16:21:37 +02:00
Hugo van Kemenade
0e993c4740
Merge pull request #4334 from radarhere/outline_width
Allow explicit zero width to hide outline
2020-02-15 14:30:12 +02:00
Hugo van Kemenade
cc3c743c70
Merge pull request #4297 from radarhere/container
Change ContainerIO return type to match file object mode
2020-02-15 14:29:32 +02:00
Andrew Murray
6c8880bf36
Merge pull request #4308 from radarhere/warnings
Fixed Quant sign comparison warnings
2020-02-15 23:28:26 +11:00
Andrew Murray
07b9f89056 Updated CHANGES.rst [ci skip] 2020-02-15 22:47:59 +11:00
Andrew Murray
74351dc692 Fixed sign comparison warnings 2020-02-15 22:13:23 +11:00
Andrew Murray
8acf77a042 For effiency, set newline character outside of loop 2020-02-15 22:13:10 +11:00
Andrew Murray
f958e2f8ed Return strings or bytes from ContainerIO according to the file object mode 2020-02-15 22:13:10 +11:00
Jon Dufresne
e817ed0d3e Correct str/bytes mixup in ContainerIO
Image data is expected to be read in bytes mode, not text mode so
ContainerIO should return bytes in all methods. The passed in file
handler is expected to be opened in bytes mode (as TarIO already does).
2020-02-15 22:13:10 +11:00
Andrew Murray
d03d390a0d
Merge pull request #4422 from radarhere/imagedraw
Updated test
2020-02-15 22:12:30 +11:00
Andrew Murray
919abe2555 Updated test 2020-02-15 21:17:26 +11:00
Hugo van Kemenade
862d471ded
Merge pull request #4356 from radarhere/releases
Updated release schedule
2020-02-15 12:10:15 +02:00
Hugo van Kemenade
c57e4b3a85
Merge pull request #4333 from radarhere/polygon
Only draw each polygon pixel once
2020-02-15 11:57:14 +02:00
Hugo van Kemenade
4004f4860d
Merge pull request #4421 from radarhere/gha
Added GitHub Actions links to badges
2020-02-15 07:27:27 +02:00
Andrew Murray
03fc9f341e Added GitHub Actions links to badges [ci skip] 2020-02-15 10:58:04 +11:00
Andrew Murray
9174a4596c
Merge pull request #4420 from jdufresne/which
Simplify command discovery with stdlib shutil.which()
2020-02-15 10:23:04 +11:00
Jon Dufresne
e544fd5fb7 Simplify command discovery with stdlib shutil.which()
Use the builtin shutil.which() instead of reimplementing.

For the single use that used the output of the command, use
subprocess.run().
2020-02-14 14:55:46 -08:00
Hugo
affade7595 Replace unittest with pytest 2020-02-13 12:15:05 +02:00
Hugo van Kemenade
098406c304
Merge pull request #4390 from jdufresne/resource-warning
Fix ResourceWarning emitted during tests
2020-02-12 17:10:51 +02:00
Hugo van Kemenade
c56f5bafc0 Merge pull request #4413 from radarhere/python3
Changed example plugin to work in Python 3
2020-02-09 09:05:33 +02:00
Andrew Murray
8e7010d9ae Changed example plugin to work in Python 3 [ci skip] 2020-02-09 15:34:14 +11:00
Hugo van Kemenade
6a8220cb3e
Merge pull request #4399 from hugovk/PillowTestCase-to-pytest
Convert most PillowTestCase methods to pytest
2020-02-08 19:37:47 +02:00
Hugo van Kemenade
28a4982950
Merge pull request #4412 from radarhere/redirect
Updated redirected URL
2020-02-08 06:57:49 +02:00
Hugo van Kemenade
16f87ff8b1 Merge pull request #4411 from radarhere/installation
Removed mentions of Python 2
2020-02-08 06:55:43 +02:00
Andrew Murray
af4bc0a1f6 Updated redirected URL 2020-02-08 11:54:57 +11:00
Andrew Murray
a8d4aca98d Removed mentions of Python 2 2020-02-08 11:45:51 +11:00
Andrew Murray
d9e6abf8cf
Merge pull request #4410 from uploadcare/already-int
Math functions return int in Python 3
2020-02-08 09:14:27 +11:00
Alexander
54f3dc6006 Math functions return int in Python 3 2020-02-08 00:34:53 +03:00