Update tests to use tempfile.mkdir in examples