Use tempfile in test