1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
.. _running-tests:
Running tests
=============
Wand has unit tests and regression tests. It can be run using
:file:`setup.py` script:
.. sourcecode:: console
$ python setup.py test
It uses pytest_ as its testing library. The above command will automatically
install pytest as well if it's not installed yet.
Or you can manually install pytest and then use :program:`pytest` command.
It provides more options:
.. sourcecode:: console
$ pip install pytest
$ pytest
.. _pytest: http://pytest.org/
Skipping tests
--------------
There are some time-consuming tests. You can skip these tests using
``--skip-slow`` option:
.. sourcecode:: console
$ pytest --skip-slow
Be default, tests include regression testing for the PDF format. Test cases
will fail if the system does not include `Ghostscript`_ binaries. You can skip
PDF dependent tests with ``--skip-pdf`` option:
.. sourcecode:: console
$ pytest --skip-pdf
.. _Ghostscript: https://www.ghostscript.com
The same behavior is true for `Fourier Transform`_ library. Use ``--skip-fft``
to skip over any discrete Fourier transformation test cases.
.. sourcecode:: console
$ pytest --skip-fft
.. _Fourier Transform: http://www.fftw.org/
You can run only tests you want using ``-k`` option.
.. sourcecode:: console
$ pytest -k image
The source code repository for Wand doesn't ship any `pytest.ini` configuration
files. However nightly regression test are usually run in parallel with coverage
reports. An example `pytest.ini` file might look like::
[pytest]
addopts=-n8 -rsfEw --cov wand --cov-report html
Using tox_
----------
Wand should be compatible with various Python implementations including
CPython & PyPy. tox_ is a testing software that helps Python packages to test
on various Python implementations at a time.
It can be installed using :program:`pip`:
.. sourcecode:: console
$ pip install tox
If you type just :program:`tox` at Wand directory it will be tested
on multiple Python interpreters:
.. sourcecode:: console
$ tox
pypy3: install_deps> python -I -m pip install pytest pytest-forked
pypy3: install_package> python -I -m pip install [...] Wand-X.X.X.tar.gz
pypy3: commands[0]> pytest --forked
...
You can use a double ``--`` to pass options to pytest:
.. sourcecode:: console
$ tox -- -k sequence
.. _tox: http://tox.testrun.org/
Continuous Integration
----------------------
`GitHub Actions`_ automatically builds and tests every commit and pull request.
The above banner image shows the current status of Wand build.
You can see the detail of the current status from the following URL:
https://github.com/emcconville/wand/actions
.. _GitHub Actions: https://docs.github.com/en/actions
Code Coverage
-------------
Coveralls_ support tracking Wand's test coverage. The above banner image
shows the current status of Wand coverage. You can see the details of the
current status from the following URL:
https://coveralls.io/r/emcconville/wand
.. _Coveralls: https://coveralls.io/
|