convert tests to use Tempfile.