Skip to content

Commit

Permalink
Merge pull request #1794 from DKilkenny/show_progress_error
Browse files Browse the repository at this point in the history
Fixed show_progress error
  • Loading branch information
swryan committed Dec 16, 2020
2 parents 5118440 + 31be71a commit 97c55f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions openmdao/core/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,9 @@ def check_totals(self, of=None, wrt=None, out_stream=_DEFAULT_OUT_STREAM, compac
For 'rel error', 'abs error', 'magnitude' the value is: A tuple containing norms for
forward - fd, adjoint - fd, forward - adjoint.
"""
if out_stream == _DEFAULT_OUT_STREAM:
out_stream = sys.stdout

if self._metadata['setup_status'] < _SetupStatus.POST_FINAL_SETUP:
raise RuntimeError(self.msginfo + ": run_model must be called before total "
"derivatives can be checked.")
Expand Down
5 changes: 4 additions & 1 deletion openmdao/core/tests/test_check_derivs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from openmdao.test_suite.components.simple_comps import DoubleArrayComp
from openmdao.test_suite.components.array_comp import ArrayComp
from openmdao.test_suite.groups.parallel_groups import FanInSubbedIDVC, Diamond
from openmdao.utils.assert_utils import assert_near_equal, assert_warning, assert_check_partials
from openmdao.utils.assert_utils import assert_near_equal, assert_warning, assert_check_partials, \
assert_no_warning
from openmdao.utils.mpi import MPI

try:
Expand Down Expand Up @@ -2586,6 +2587,8 @@ def test_check_totals_show_progress(self):
lines = stream.getvalue()
self.assertFalse("Checking derivatives with respect to" in lines)

prob.check_totals(method='fd', show_progress=True)

def test_desvar_as_obj(self):
prob = om.Problem()
prob.model = SellarDerivatives()
Expand Down

0 comments on commit 97c55f0

Please sign in to comment.