def test_script(): '''Call a simple script that writes a short file''' fname = os.tmpnam() scriptname = os.tmpnam() arg = 'Hello, world!' code = '''openw, 5, '{0}' printf, 5, '{1}' close, 5 ''' with GDLFile(code.format(fname, arg)) as script: GDL.script(script) ret = open(fname).read().strip() os.unlink(fname) assert arg == ret
def test_script(): '''Call a simple script that writes a short file''' with warnings.catch_warnings(): warnings.simplefilter("ignore") fname = tempfile.mkstemp()[1] scriptname = tempfile.mkstemp()[1] arg = 'Hello, world!' code = '''openw, 5, '{0}' printf, 5, '{1}' close, 5 ''' with GDLFile(code.format(fname, arg)) as script: GDL.script(script) ret = open(fname).read().strip() os.unlink(fname) assert arg == ret