ENH make mktempdir more idiomatic plus the test too