-
Notifications
You must be signed in to change notification settings - Fork 36
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
formatting should not matter in comparaison #125
Comments
You mean the hook is formatting the generated files? In that case I suggest using a different extension, or configure pre-commit to not format the generated files somehow. |
this is what I did, so everything works smoothly now but I was thinking that being format dependant (order, indentation, etc...) should not be the case as I don't formally generate a yaml file but just a dict. I slept on it and I was thinking maybe this lib could simply format the generated and saved yaml before comparing (reorder keys + using a consistent formatting). If you think it's useless extra-burden, you can close this issue (I'll write down the workaround for prettier pre-commit) |
It is a good point, to actually compare the data instead of diff-ing the files: diffing the files could be done later, if the comparison fails (just to better visualize the differences). |
I also would argue that comparing the dicts directly instead of the files is the way to go. |
I started using pytest-regressions in sphinx repository where we mostly build html content. this time I'm usinge the
data_regression
feature and I really like it.THe problem is that my libs are always parsed by a prettier pre-commit hook which does the following for yaml files:
The consequence is that comparaison performed by the lib is failing because the 2 files are effectively different. I think that's the same provblem as #50, we want to compare data and in the background pytest-regressions is comparaing files (which implies that formatting and order are taken into account when they shouldn't).
Would it be possible to change paradigm and instead of transforming data to a file and then compare, read the source first as a dict and compare them with the data ?
Happy to help building up a PR if someone that knows the lib better confirms it could be possible
The text was updated successfully, but these errors were encountered: