Remove hardcode with tests cache directory and use temporary directory