Skip to content

Commit

Permalink
Ensure in_testing_environment and matplottlib are resolved earlier in…
Browse files Browse the repository at this point in the history
… doctest
  • Loading branch information
jsiirola committed Oct 14, 2024
1 parent 690222c commit f2827f1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doc/OnlineDocs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f2827f1

Please sign in to comment.