TST: remove insecure mktemp use in tests

mktemp only returns a filename, a malicous user could replace it before
it gets used.
Merge pull request #3289 from juliantaylor/mktemp-remove

TST: remove insecure mktemp use in tests