Skip to content

Commit f2827f1

Browse files
committed
Ensure in_testing_environment and matplottlib are resolved earlier in doctest
1 parent 690222c commit f2827f1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

doc/OnlineDocs/conf.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ def check_output(self, want, got, optionflags):
281281
platform.python_implementation()
282282
)
283283
284+
# Mark that we are testing code (in this case, testing the documentation)
285+
from pyomo.common.flags import in_testing_environment
286+
in_testing_environment(True)
287+
284288
# We need multiprocessing because some doctests must be skipped if the
285289
# start method is not "fork"
286290
import multiprocessing
@@ -296,6 +300,9 @@ def check_output(self, want, got, optionflags):
296300
)
297301
from pyomo.contrib.parmest.parmest import parmest_available
298302
303+
# Ensure that the matplotlib import has been resolved (and the backend changed)
304+
bool(matplotlib_available)
305+
299306
# Not using SolverFactory to check solver availability because
300307
# as of June 2020 there is no way to suppress warnings when
301308
# solvers are not available
@@ -326,10 +333,6 @@ def check_output(self, want, got, optionflags):
326333
ma27_available = False
327334
mumps_available = False
328335
329-
# Mark that we are testing code (in this case, testing the documentation)
330-
from pyomo.common.flags import in_testing_environment
331-
in_testing_environment(True)
332-
333336
# Prevent any Pyomo logs from propagating up to the doctest logger
334337
import logging
335338
logging.getLogger('pyomo').propagate = False

0 commit comments

Comments
 (0)