Skip to content

Developer FAQ (AKA FAQ D)

jbrockmendel edited this page May 22, 2019 · 1 revision

This page contains FAQ information for developers and contributors to statsmodels.

Before being added to this page, a question or note will usually be found in an Issue with "FAQ-D" in its title.


Testing

Debugging warnings with pytest (#5482)

To find the warning and debug it, we can convert the warning into an error e.g.:

$ pytest -v --pdb -W error::RuntimeWarning statsmodels/gam/tests/test_gam.py

example usage #5481 (comment)

Matplotlib plotting unit tests (#5245)

The test module needs to import pytest

If pyplot, plt, is needed in the test module, then it should be imported in a try ... except clause because matplotlib is an optional dependency

try:
    import matplotlib.pyplot as plt
except ImportError:  # pragma: no cover
    pass

A plotting unit test will be automatically skipped and figures will be closed using the following pytest fixtures provided by the pytest.mark.matplotlib decorator and the `close_figures argument

@pytest.mark.matplotlib
def test_plot_xxx(close_figures):

Changed in #4913 and #5165.