def run_file(filename): orig_quiet = settings.is_quiet() settings.set_quiet(True) prog = program.load(filename) assert prog.evaluate().result.succeeded() settings.set_quiet(orig_quiet)
def run_file(filename, expected_output): orig_quiet = settings.is_quiet() settings.set_quiet(True) f = io.StringIO() with redirect_stdout(f): prog = program.load(filename) assert prog.evaluate().result.succeeded() assert f.getvalue().strip() == expected_output.strip() settings.set_quiet(orig_quiet)