def test_invoke_compile():
py.magic.invoke(compile=True)
try:
co = compile("""if 1:
def f():
return 1
-> \n""", '', 'exec')
d = {}
exec co in d
assert py.code.Source(d['f'])
finally:
py.magic.revoke(compile=True)