Commit Graph

16 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
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
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Andrew Murray
b560f5b417 Changed Python version checks in tests to use helper 2018-04-19 19:40:56 +10:00
Jon Dufresne
e705cd1476 Fix dereferencing type-punned pointer will break strict-aliasing
Compiler warning appeared as:

src/path.c:574:22: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
                      Py_TYPE(&item)->tp_name);
                      ^~~~~~~

As item is already of type PyObject*, and the Py_TYPE macro is
equivalent to (((PyObject*)(o))->ob_type), no need for the dereference.

https://docs.python.org/3/c-api/structures.html#c.Py_TYPE
2018-04-03 20:42:03 -07:00
Jon Dufresne
f041188050 Replace try/except/fail pattern with TestCase.assertRaises()
Replace pattern with the builtin support for asserting exceptions.
2016-11-06 13:43:09 -08:00
hugovk
2c4a1209f4 flake8 2016-08-04 09:40:12 +03:00
homm
1ba4e9e5ba remove end of file banner from all files 2016-07-10 14:11:28 +03:00
Andrew Murray
6de51536c4 Replaced mixed tabs and spaces with spaces 2016-05-10 22:23:23 +10:00
wiredfool
0c4131bf67 Fixing tests on windows/32bit 2016-03-26 15:01:26 -07:00
wiredfool
f65fcf7274 Fixing the tests on py 3.x 2016-03-16 10:13:51 +00:00
wiredfool
c6ec3be0d6 Fix for integer overflow in path.c 2016-03-15 19:56:40 +00:00
hugovk
cf04a9a0d2 Remove unused tearDownModule 2014-07-07 20:03:50 +03:00
hugovk
3ec505958e Convert old tests to use unittest 2014-06-10 12:10:47 +03:00
wiredfool
2322619372 fixed deprecation warnings for tostring on array.array 2013-05-23 10:33:27 -07:00
Brian Crowell
ad784eb808 py3k: Import Christoph Gohlke's test suite
This is Christoph Gohlke's test suite from his personal PIL package found
at http://www.lfd.uci.edu/~gohlke/pythonlibs/.

This is just to bring it in as a separate commit. Future commits will align
it with Pillow.
2013-01-10 08:46:39 -06:00