def test_iprint(self):

        top = Problem()
        top.root = SellarStateConnection()
        top.setup(check=False)

        base_stdout = sys.stdout

        try:
            ostream = cStringIO()
            sys.stdout = ostream
            top.run()
        finally:
            sys.stdout = base_stdout

        printed = ostream.getvalue()
        self.assertEqual(printed, '')

        # Turn on all iprints
        top.print_all_convergence()

        try:
            ostream = cStringIO()
            sys.stdout = ostream
            top.run()
        finally:
            sys.stdout = base_stdout

        printed = ostream.getvalue()
        self.assertEqual(printed.count('NEWTON'), 3)
        self.assertEqual(printed.count('GMRES'), 4)
        self.assertTrue('[root] NL: NEWTON   0 | ' in printed)
        self.assertTrue('   [root.sub] LN: GMRES   0 | ' in printed)
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/test/test_problem.py/TestProblem.test_iprint/original