def _compare_output_script(content): t_file = tempfile.NamedTemporaryFile("r+") os.chmod(t_file.name, 0777) t_file.write(content) t_file.seek(0) fname = t_file.name python = pexpect.spawn("python {}".format(fname)) moonpy = pexpect.spawn("python moonpy.py {}".format(fname)) python.expect(pexpect.EOF) moonpy.expect(pexpect.EOF) return python.before, moonpy.before
def _compare_output_dash_c(command): python = pexpect.spawn("python -c '{}'".format(command)) moonpy = pexpect.spawn("python moonpy.py -c '{}'".format(command)) python.expect(pexpect.EOF) moonpy.expect(pexpect.EOF) return python.before, moonpy.before