Skip to content

Commit

Permalink
Merge 7970524 into 81538c7
Browse files Browse the repository at this point in the history
  • Loading branch information
DKilkenny committed Oct 23, 2019
2 parents 81538c7 + 7970524 commit 82252ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
3 changes: 2 additions & 1 deletion openmdao/core/system.py
Expand Up @@ -2021,12 +2021,13 @@ def resolve(to_match, io_types, matches, proms):

not_found = (set(names).union(renames).union(patterns)) - found
if not_found:
print(not_found)
if len(io_types) == 2:
call = 'promotes'
else:
call = 'promotes_%ss' % io_types[0]
raise RuntimeError("%s: '%s' failed to find any matches for the following "
"names or patterns: %s." %
"names or patterns: %s. Check to make sure it is not empty" %
(self.msginfo, call, sorted(not_found)))

maps = {'input': {}, 'output': {}}
Expand Down
32 changes: 25 additions & 7 deletions openmdao/core/tests/test_group.py
Expand Up @@ -408,7 +408,8 @@ def test_group_renames_errors_not_found(self):
p.setup()
self.assertEqual(str(err.exception),
"IndepVarComp (comp1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['xx'].")
"the following names or patterns: ['xx']. "
"Check to make sure it is not empty")

def test_group_renames_errors_bad_tuple(self):
p = om.Problem()
Expand Down Expand Up @@ -473,7 +474,8 @@ def setup(self):
p.setup()
self.assertEqual(str(err.exception),
"SellarDis2 (d1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['foo'].")
"the following names or patterns: ['foo']. "
"Check to make sure it is not empty")

def test_group_nested_conn(self):
"""Example of adding subsystems and issuing connections with nested groups."""
Expand Down Expand Up @@ -659,7 +661,8 @@ def test_promote_not_found1(self):
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['x*'].")
"the following names or patterns: ['x*']. "
"Check to make sure it is not empty")

def test_promote_not_found2(self):
p = om.Problem()
Expand All @@ -672,7 +675,8 @@ def test_promote_not_found2(self):
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes_inputs' failed to find any matches for "
"the following names or patterns: ['xx'].")
"the following names or patterns: ['xx']. "
"Check to make sure it is not empty")

def test_promote_not_found3(self):
p = om.Problem()
Expand All @@ -685,7 +689,19 @@ def test_promote_not_found3(self):
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (C2): 'promotes' failed to find any matches for "
"the following names or patterns: ['xx'].")
"the following names or patterns: ['xx']. "
"Check to make sure it is not empty")

def test_empty_group(self):
p = om.Problem()
g1 = p.model.add_subsystem('G1', om.Group(), promotes=['*'])

with self.assertRaises(Exception) as context:
p.setup()
self.assertEqual(str(context.exception),
"Group (G1): 'promotes' failed to find any matches for "
"the following names or patterns: ['*']. "
"Check to make sure it is not empty")

def test_missing_promote_var(self):
p = om.Problem()
Expand All @@ -700,7 +716,8 @@ def test_missing_promote_var(self):
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (d1): 'promotes_inputs' failed to find any matches for "
"the following names or patterns: ['foo'].")
"the following names or patterns: ['foo']. "
"Check to make sure it is not empty")

def test_missing_promote_var2(self):
p = om.Problem()
Expand All @@ -715,7 +732,8 @@ def test_missing_promote_var2(self):
p.setup()
self.assertEqual(str(context.exception),
"ExecComp (d1): 'promotes_outputs' failed to find any matches for "
"the following names or patterns: ['bar', 'blammo'].")
"the following names or patterns: ['bar', 'blammo']. "
"Check to make sure it is not empty")

def test_promote_src_indices(self):
import numpy as np
Expand Down

0 comments on commit 82252ef

Please sign in to comment.