Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot should take snapshot of data at the moment when snapshot is being taken 😁 #158

Open
jentyk opened this issue Mar 3, 2021 · 2 comments

Comments

@jentyk
Copy link

jentyk commented Mar 3, 2021

I know that title sounds a bit silly, but what I meant is that when the "assert_match" method is run, what should be recorded is a copy of the data, not a reference.
It seems that currently what is being recorded is a reference and at the moment of saving the whole snapshot file if the same property is snapshotted twice and it changes in the meantime only the latest value is being saved twice.

@rgalanakis
Copy link

To elaborate on this some more:
When a snapshot is stored (or matched, and none exists, and store is called), a reference is stored. This reference is formatted into a representation during tearDownClass. This means that if things are active during the comparison (like context managers), they may not be active when the snapshot is written. (we use a context manager to normalize Django model reprs so we can ignore things like FK columns).

I think the fix may be to format the data when it's stored, rather than on save.

@15r10nk
Copy link

15r10nk commented Jul 12, 2023

this is a duplicate of #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants