Commit Graph

23 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
e7749abdf9 Corrected error in restoring sys.stdout 2021-05-07 20:44:46 +10:00
Andrew Murray
0f68e63793 Allow for sys.stdout.buffer to be missing 2021-05-03 18:07:05 +10:00
Andrew Murray
9c06ce044c Changed PSDraw default from sys.stdout to sys.stdout.buffer 2021-04-29 21:35:57 +10:00
Andrew Murray
7fd9663198 Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +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
Hugo
5631718a8d Format with Black 2019-06-13 18:54:46 +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
63d0a5a326 Added anchor to readthedocs URL 2017-02-11 12:47:10 +11:00
Andrew Murray
a06dd59df7 Added context managers 2016-12-28 09:54:10 +11:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +03:00
hugovk
11b8faa761 Update RTD links https://blog.readthedocs.com/securing-subdomains/ 2016-04-28 09:35:03 +03:00
Andrew Murray
f5df0b86fc Fixed PSDraw stdout Python 3 compatibility 2015-07-31 20:59:59 +10:00
hugovk
7f057ed962 Test drawing diagonal lines 2014-12-27 22:50:17 +02:00
hugovk
31859521c9 Update test as textsize() isn't implemented 2014-12-27 22:04:34 +02:00
hugovk
6da05b4026 Use fp instead of filename 2014-12-11 13:20:11 +02:00
hugovk
385ad47a9b Test PSDraw 2014-12-11 13:06:53 +02:00