diff --git a/doc/OnlineDocs/conf.py b/doc/OnlineDocs/conf.py index 380b93d053c..439e43a74c0 100644 --- a/doc/OnlineDocs/conf.py +++ b/doc/OnlineDocs/conf.py @@ -281,6 +281,10 @@ def check_output(self, want, got, optionflags): platform.python_implementation() ) +# Mark that we are testing code (in this case, testing the documentation) +from pyomo.common.flags import in_testing_environment +in_testing_environment(True) + # We need multiprocessing because some doctests must be skipped if the # start method is not "fork" import multiprocessing @@ -296,6 +300,9 @@ def check_output(self, want, got, optionflags): ) from pyomo.contrib.parmest.parmest import parmest_available +# Ensure that the matplotlib import has been resolved (and the backend changed) +bool(matplotlib_available) + # Not using SolverFactory to check solver availability because # as of June 2020 there is no way to suppress warnings when # solvers are not available @@ -326,10 +333,6 @@ def check_output(self, want, got, optionflags): ma27_available = False mumps_available = False -# Mark that we are testing code (in this case, testing the documentation) -from pyomo.common.flags import in_testing_environment -in_testing_environment(True) - # Prevent any Pyomo logs from propagating up to the doctest logger import logging logging.getLogger('pyomo').propagate = False