def test_check_parallel_derivs(self):

        prob = Problem()
        root = prob.root = Group()

        root.add('p1', IndepVarComp('a', 1.0), promotes=['*'])
        root.add('p2', IndepVarComp('b', 1.0), promotes=['*'])
        sub1 = root.add('sub1', Group(), promotes=['*'])
        sub1.ln_solver = LinearGaussSeidel()
        sub2 = sub1.add('sub2', Group(), promotes=['*'])
        sub2.add('comp', ExecComp(['x = 2.0*a + 3.0*b', 'y=4.0*a - 1.0*b']), promotes=['*'])
        sub2.ln_solver = LinearGaussSeidel()

        root.ln_solver.options['mode'] = 'fwd'
        sub1.ln_solver.options['mode'] = 'fwd'
        sub2.ln_solver.options['mode'] = 'fwd'

        prob.setup(check=False)
        prob.run()

        root.ln_solver = LinearGaussSeidel()
        root.ln_solver.options['single_voi_relevance_reduction'] = True
        prob.driver.add_desvar('p1.a', 1.0)
        prob.driver.add_constraint('x', upper=0.0)
        prob.driver.add_constraint('y', upper=0.0)
        with warnings.catch_warnings(record=True) as w:
            if not MPI:
                # suppress warning about not running under MPI
                warnings.simplefilter("ignore")
            prob.driver.parallel_derivs(['x','y'])

        root.ln_solver.options['mode'] = 'rev'
        sub1.ln_solver.options['mode'] = 'rev'

        prob._setup_errors = []
        mode = prob._check_for_parallel_derivs(['a'], ['x'], True, False)

        msg  = "Group 'sub2' has mode 'fwd' but the root group has mode 'rev'. Modes must match to use parallel derivative groups."
        self.assertTrue(msg in prob._setup_errors[0])


        sub1.ln_solver.options['mode'] = 'fwd'
        sub2.ln_solver.options['mode'] = 'rev'


        prob._setup_errors = []
        mode = prob._check_for_parallel_derivs(['a'], ['x'], True, False)

        msg  = "Group 'sub1' has mode 'fwd' but the root group has mode 'rev'. Modes must match to use parallel derivative groups."
        self.assertTrue(msg in prob._setup_errors[0])


        sub1.ln_solver.options['mode'] = 'rev'
        mode = prob._check_for_parallel_derivs(['a'], ['x'], True, False)
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/test/test_problem.py/TestProblem.test_check_parallel_derivs/original