def _run_ryu_manager_and_check_output(self, app):
        cmd = [PYTHON_BIN, RYU_MGR, app]
        p = Popen(cmd, stdout=PIPE, stderr=STDOUT)

        while True:
            if p.poll() is not None:
                raise Exception('Another ryu-manager already running?')

            line = p.stdout.readline().strip()
            if line == '':
                time.sleep(1)
                continue

            print("ryu-manager: %s" % line)
            if line.find('TEST_FINISHED') != -1:
                ok_(line.find('Completed=[True]') != -1)
                p.terminate()
                p.communicate()  # wait for subprocess is terminated
                break
dataset/ETHPy150Open osrg/ryu/ryu/tests/integrated/run_tests_with_ovs12.py/TestWithOVS12._run_ryu_manager_and_check_output/original