def run_test_inprocess(testdir): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() old_cwd = os.getcwd() os.chdir(testdir) returncode = meson_test.run(['meson-private/meson_test_setup.dat']) sys.stdout = old_stdout sys.stderr = old_stderr os.chdir(old_cwd) return (returncode, mystdout.getvalue(), mystderr.getvalue())
def run_test_inprocess(testdir): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() old_cwd = os.getcwd() os.chdir(testdir) try: returncode_test = meson_test.run(['meson-private/meson_test_setup.dat']) returncode_benchmark = meson_benchmark.run(['meson-private/meson_benchmark_setup.dat']) finally: sys.stdout = old_stdout sys.stderr = old_stderr os.chdir(old_cwd) return (max(returncode_test, returncode_benchmark), mystdout.getvalue(), mystderr.getvalue())