# Running tests

Wand has unit tests and regression tests. It can be run using `setup.py` script:

    $ 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 pytest command. It provides more options:

    $ pip install pytest
    $ pytest

## Skipping tests

There are some time-consuming tests. You can skip these tests using `--skip-slow` option:

    $ pytest --skip-slow

By 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:

    $ pytest --skip-pdf

The same behavior is true for Fourier Transform library. Use `--skip-fft` to skip over any discrete Fourier transformation test cases.

    $ pytest --skip-fft

You can run only tests you want using `-k` option.

    $ 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 pip:

    $ pip install tox

If you type just tox at Wand directory it will be tested on multiple Python interpreters:

    $ 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:

    $ tox -- -k sequence

## 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

## 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