def test_tracing(self): # Check tracing of iteration coordinates. top = Assembly() comp = top.add('comp1', Dummy()) top.add('driverA', Driver()) comp = top.add('comp2', Dummy()) top.add('driverB', Driver()) sub = top.add('subassy', Assembly()) comp = sub.add('comp3', Dummy()) sub.driver.workflow.add('comp3') top.driver.workflow = SequentialWorkflow() top.driver.workflow.add(('comp1', 'driverA', 'driverB')) top.driverA.workflow.add(('comp1', 'comp2')) top.driverB.workflow.add(('comp2', 'subassy')) trace_out = cStringIO.StringIO() enable_trace(trace_out) top.run() expected = """\ 1-comp1 1-driverA.1-comp1 1-driverA.1-comp2 1-driverB.1-comp2 1-driverB.1-subassy.1-comp3 """ self.assertEqual(trace_out.getvalue(), expected) disable_trace() top.run() self.assertEqual(trace_out.getvalue(), expected)
def test_tracing(self): # Check tracing of iteration coordinates. top = Assembly() comp = top.add("comp1", Dummy()) comp.force_execute = True top.add("driverA", Driver()) comp = top.add("comp2", Dummy()) comp.force_execute = True top.add("driverB", Driver()) sub = top.add("subassy", Assembly()) sub.force_execute = True comp = sub.add("comp3", Dummy()) comp.force_execute = True sub.driver.workflow.add("comp3") top.driver.workflow = SequentialWorkflow() top.driver.workflow.add(("comp1", "driverA", "driverB")) top.driverA.workflow.add(("comp1", "comp2")) top.driverB.workflow.add(("comp2", "subassy")) trace_out = cStringIO.StringIO() enable_trace(trace_out) top.run() expected = """\ 1-1 1-2.1-1 1-2.1-2 1-3.1-1 1-3.1-2.1-1 """ self.assertEqual(trace_out.getvalue(), expected) disable_trace() top.run() self.assertEqual(trace_out.getvalue(), expected)