Commit Graph

15 Commits

Author SHA1 Message Date
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
Hugo
1885a2cef5
Merge pull request #3579 from jdufresne/run-one-test
Improve pytest configuration to allow specific tests as CLI args
2019-02-03 11:30:57 +02:00
Andrew Murray
a33e71a9df Changed string to comment 2019-02-03 15:59:24 +11: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
2202196162 Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
Andrew Murray
e8cba27bb1 Changed assert checks to more specific versions 2017-06-03 14:04:54 +10:00
Andrew Murray
97a2d42dac Removed unused print_function imports 2017-01-18 20:06:21 +11:00
Chris Hogan
711e95e361 Fix bug in test_idf_rational_save
A boolean wrapped in parentheses is still a boolean, not a tuple.
The comma makes this an actual tuple so it can be iterated on in
the for loop.
2016-12-01 11:10:03 -06:00
Andrew Murray
3dcef86fe5 Added missing top-level test code 2016-11-14 21:12:25 +11:00
hugovk
2c4a1209f4 flake8 2016-08-04 09:40:12 +03:00
wiredfool
be2100be7b Skip tests that require libtiff if it is not installed, fixes #1866 2016-05-06 09:07:00 -07:00
Andrew Murray
677b958a7f Health fixes 2016-04-01 21:49:30 +11:00
Andrew Murray
0ad6f5ff1f Updated deprecated asserts 2016-01-24 12:44:31 +11:00
wiredfool
3ac9396e8c Write round trip for rationals, including nan value 2015-12-29 22:00:36 +00:00
wiredfool
722ee8240b Inherit from Rational instead of Fraction, some basic tests. Fixes Py2.6 2015-12-27 10:21:32 +00:00