Unit tests

Unit tests are in the tests directory. Individual scripts can be run from this directory, or test_all.py will run all tests in all scripts.

spacepy must be installed before running the tests. To avoid affecting an installed version while testing, use a separate venv or conda environment, or install in a custom location using --prefix and manually edit PYTHONPATH.

Using an editable install may be useful to save time with repeated installs while editing.

The spacepy_testing module

The spacepy_testing module contains utilities for assistance with testing SpacePy. It is not installed as part of SpacePy and is thus only importable from the unit test scripts themselves (which are in the same directory). All unit test scripts import this module.

Classes


assertWarns(test[, action, message, ...])

Tests that a warning is raised.

assertDoesntWarn(test[, action, message, ...])

Tests that a warning is not raised.

Functions


add_build_to_path()

Adds the python build directory to the search path.

Data


datadir

Directory containing unit test data

testsdir

Directory containing the unit test scripts


Release:

0.5.0

Doc generation date:

Mar 08, 2024