syrusakbary / snapshottest

Snapshot Testing utils for Python 📸
MIT License
525 stars 102 forks source link

Generate snapshot declarations before opening output file #146

Open estyrke opened 3 years ago

estyrke commented 3 years ago

If there is an error while generating the declarations, the output file will be truncated. This will cause existing snapshots to disappear, as well as make further runs fail because of an invalid snapshot file.

paulmelnikow commented 3 years ago

Hi! Thanks for the contribution. This change makes sense to me.

It would be good to include a functional test of the problem this is trying to fix, so that it does not regress in the future.