Commit Graph

9839 Commits

Author SHA1 Message Date
Andrew Murray
02ca4a1a7f
Merge pull request #4138 from jdufresne/skip-known
Remove unused arguments from PillowTestCase.skipKnownBadTest()
2019-10-13 06:42:02 +11:00
Hugo
3dac6e2c62 Replace ImageShow.which() with stdlib
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-12 21:40:11 +03:00
Jon Dufresne
9981568982 Simpilify PillowTestCase.delete_tempfile for pytest
As the test suite always runs with pytest now, self.currentResult is
always None. Using this, can remove unused code.
2019-10-12 11:13:14 -07:00
Jon Dufresne
4cd4adddc3 Improve handling of file resources
Follow Python's file object semantics. User code is responsible for
closing resources (usually through a context manager) in a deterministic
way.

To achieve this, remove __del__ functions. These functions used to
closed open file handlers in an attempt to silence Python
ResourceWarnings. However, using __del__ has the following drawbacks:

- __del__ isn't called until the object's reference count reaches 0.
  Therefore, resource handlers remain open or in use longer than
  necessary.

- The __del__ method isn't guaranteed to execute on system exit. See the
  Python documentation:

  https://docs.python.org/3/reference/datamodel.html#object.__del__

  > It is not guaranteed that __del__() methods are called for objects
  > that still exist when the interpreter exits.

- Exceptions that occur inside __del__ are ignored instead of raised.
  This has the potential of hiding bugs. This is also in the Python
  documentation:

  > Warning: Due to the precarious circumstances under which __del__()
  > methods are invoked, exceptions that occur during their execution
  > are ignored, and a warning is printed to sys.stderr instead.

Instead, always close resource handlers when they are no longer in use.
This will close the file handler at a specified point in the user's code
and not wait until the interpreter chooses to. It is always guaranteed
to run. And, if an exception occurs while closing the file handler, the
bug will not be ignored.

Now, when code receives a ResourceWarning, it will highlight an area
that is mishandling resources. It should not simply be silenced, but
fixed by closing resources with a context manager.

All warnings that were emitted during tests have been cleaned up. To
enable warnings, I passed the `-Wa` CLI option to Python. This exposed
some mishandling of resources in ImageFile.__init__() and
SpiderImagePlugin.loadImageSeries(), they too were fixed.
2019-10-12 08:27:17 -07:00
Jon Dufresne
0affbacd5e Remove unused arguments from PillowTestCase.skipKnwonBadTest() 2019-10-12 08:17:20 -07:00
Jon Dufresne
911079cc68 Add PyPy3 to the tox test matrix
Allows contributors to automatically test locally.
2019-10-12 07:56:43 -07:00
nulano
accbe58b5e add Python version to selftest, rename brief parameter 2019-10-12 15:40:12 +01:00
Hugo
23fa3c6979 Remove outdated OS scripts, point docs to Dockerfiles 2019-10-12 14:16:10 +03:00
Andrew Murray
7c95d9d188
Rearranged badges [ci skip]
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
2019-10-12 21:53:49 +11:00
Hugo
3e3a73749e Merge remote-tracking branch 'upstream/master' into rm-2.7 2019-10-12 13:42:25 +03:00
Andrew Murray
8cdacf8871 Added GitHub Actions badges for platform builds [ci skip] 2019-10-12 21:38:01 +11:00
Hugo van Kemenade
6595ce1609
Merge pull request #4081 from hugovk/test-with-github-actions
Test Linux and macOS with GitHub Actions
2019-10-12 13:07:28 +03:00
Hugo
a4d7861e34 Turn fail-fast off, so one failed job doesn't cancel others 2019-10-12 12:14:49 +03:00
Hugo
707c9910ab Install OS dependencies without checking version number 2019-10-12 10:49:26 +03:00
Hugo
cf8f8b1743 Drop support for EOL Python 2.7 2019-10-12 10:49:26 +03:00
Hugo
01373b4ed9 Add Codecov token to config 2019-10-12 10:49:26 +03:00
Hugo
ac5642dc76 Split script.sh into build.sh and test.sh 2019-10-12 10:49:26 +03:00
Hugo
7c7c53fbb6 Test macOS with GitHub Actions 2019-10-12 10:49:26 +03:00
Hugo
e595ddbaa1 Test with GitHub Actions 2019-10-12 10:49:26 +03:00
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7 2019-10-12 18:03:58 +11:00
Andrew Murray
078a767b77
Merge pull request #4133 from hugovk/dont-test-2.7
CI: Stop testing Python 2.7
2019-10-12 17:56:32 +11:00
Hugo van Kemenade
23c3891b81
Merge pull request #4084 from nulano/gha-win
Test Windows with GitHub Actions
2019-10-11 22:16:45 +03:00
Hugo van Kemenade
f0c08ad565
Merge branch 'master' into gha-win 2019-10-11 19:24:48 +03:00
Hugo
faa1d1f326 Stop testing Python 2.7 2019-10-11 19:05:20 +03:00
Hugo van Kemenade
7fad924ac0
Merge pull request #4132 from radarhere/orientation
Added orientation note
2019-10-11 18:42:13 +03:00
Hugo van Kemenade
8225642745
Merge pull request #4131 from radarhere/badges
Added GitHub Actions badges
2019-10-11 18:41:05 +03:00
Andrew Murray
a8c07e3d5f Added orientation note [ci skip] 2019-10-11 22:40:31 +11:00
Andrew Murray
f2abab474d Added GitHub Actions badges [ci skip] 2019-10-11 22:04:21 +11:00
Hugo van Kemenade
8c94f01842
Merge pull request #4126 from radarhere/python38
Added Python 3.8 rc1 to AppVeyor
2019-10-09 23:50:23 +03:00
Andrew Murray
1c493fb4fa Added Python 3.8 rc1 2019-10-10 06:31:18 +11:00
Andrew Murray
7e980d7613
Merge pull request #4066 from hugovk/test-docker-with-github-actions
Test Docker with GitHub Actions
2019-10-09 21:16:42 +11:00
Hugo
3e24c5fea4 Replace isStringType(t) with isinstance(t, str)
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:26:52 +03:00
Hugo
e118de943d Remove redundant __ne__ method
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:26:36 +03:00
Hugo
0caa48b179 Remove redundant __future__ from docs
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:26:11 +03:00
Hugo
3a34081db5 Simplify temporary directory cleanup
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:25:55 +03:00
Hugo
84e53e3757 Simplify using subprocess.DEVNULL
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:25:42 +03:00
nulano
a0a5601689
Merge branch 'master' into gha-win 2019-10-08 12:56:43 +01:00
Hugo van Kemenade
4c172ae266
Updated ImageOps documentation (#4125)
Updated ImageOps documentation
2019-10-08 13:44:40 +03:00
Andrew Murray
fab0205abc Updated documentation [ci skip] 2019-10-08 21:12:15 +11:00
Hugo
fc4dbf8484 Test Docker with GitHub Actions 2019-10-08 11:26:08 +03:00
Andrew Murray
6cd99fc3cf
Merge branch 'master' into rm-2.7 2019-10-08 18:57:27 +11:00
Hugo van Kemenade
a59c1b7cea
Merge pull request #4122 from jdufresne/imports
Move several imports to the top-level of the file
2019-10-08 10:13:39 +03:00
Jon Dufresne
64032061c0 Move several imports to the top-level of the file
This better follows PEP 8 style guide:

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.

This also avoids duplicate import code within the same file.
2019-10-07 06:28:36 -07:00
Hugo
4382413bb4 Remove redundant bytearray 2019-10-07 16:23:43 +03:00
Hugo
865b17d5cf Remove Python 2-compatibility code 2019-10-07 16:23:22 +03:00
Andrew Murray
7e3156eb17 Updated IFDRational operators 2019-10-07 14:30:59 +03:00
Hugo
810b61e78f Reinstate and simplify parallel auto-detection 2019-10-07 14:30:59 +03:00
Hugo
74d2767c57 Remove duplicate line 2019-10-07 14:30:59 +03:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00