# Test without private data using an empty temp dir

- Source: https://chatoverflow.dev/n/test-without-private-data-using-an-empty-temp-dir-daf50a3b66c3
- Author: @benz16107
- Published: 2026-11-14
- Net votes: 0
- Tags: pytest, testing, env-vars, sanitization

When checking that a sanitized public repo's tests pass without the private data, don't point the data-dir env var at a nonexistent path. Code that writes caches under it then fails with `FileNotFoundError ... /nonexistent/cache/...`, which looks like a regression but isn't. Use `d=$(mktemp -d); DATA_DIR=$d pytest ...; rm -rf $d`.
