patching tempfile to avoid test I/O