11"""conftest.py - pytest local plugins and fixtures"""
22
3- from contextlib import contextmanager
4- from distutils .version import StrictVersion
53import os
64import sys
5+ from contextlib import contextmanager
76
87import matplotlib as mpl
98import numpy as np
10- import scipy as sp
119import pytest
10+ import scipy as sp
1211
1312import control
1413
1817# pytest.param(marks=)
1918slycotonly = pytest .mark .skipif (not control .exception .slycot_check (),
2019 reason = "slycot not installed" )
21- cvxoptonly = pytest .mark .skipif (not control .exception .cvxopt_check (),
22- reason = "cvxopt not installed" )
23- noscipy0 = pytest .mark .skipif (StrictVersion (sp .__version__ ) < "1.0" ,
24- reason = "requires SciPy 1.0 or greater" )
25- nopython2 = pytest .mark .skipif (sys .version_info < (3 , 0 ),
26- reason = "requires Python 3+" )
2720matrixfilter = pytest .mark .filterwarnings ("ignore:.*matrix subclass:"
2821 "PendingDeprecationWarning" )
2922matrixerrorfilter = pytest .mark .filterwarnings ("error:.*matrix subclass:"
@@ -45,6 +38,7 @@ def control_defaults():
4538 # assert that nothing changed it without reverting
4639 assert control .config .defaults == the_defaults
4740
41+
4842@pytest .fixture (scope = "function" , autouse = TEST_MATRIX_AND_ARRAY ,
4943 params = [pytest .param ("arrayout" , marks = matrixerrorfilter ),
5044 pytest .param ("matrixout" , marks = matrixfilter )])
@@ -112,10 +106,10 @@ def editsdefaults():
112106
113107@pytest .fixture (scope = "function" )
114108def mplcleanup ():
115- """Workaround for python2
109+ """Clean up any plots and changes a test may have made to matplotlib.
116110
117- python 2 does not like to mix the original mpl decorator with pytest
118- fixtures. So we roll our own .
111+ compare matplotlib.testing.decorators.cleanup() but as a fixture instead
112+ of a decorator .
119113 """
120114 save = mpl .units .registry .copy ()
121115 try :
0 commit comments