pytest-golden icon indicating copy to clipboard operation
pytest-golden copied to clipboard

Add support for golden testing of whole files and directory trees

Open llucax opened this issue 2 years ago • 4 comments

I have project that generates a bunch of files, so I was looking for a library to do golden testing but not for small outputs but whole files, or even whole trees.

For now I just implemented a hacky ad-hoc golden testing to check for whole directory trees and individual files, but it would be nice to use something more standard and less hacky.

This is actually the only Python golden testing library I found that looks legit, so I was wondering if there is any interest in supporting this use case. If so, I might even prepare and submit a PR eventually, but I will only dedicate this extra effort if the feature is welcome :)

Thanks!

llucax avatar Jul 09 '23 20:07 llucax

Hm interesting. At first I imagined that the overlap between the functionality of writing YAML files and writing directory trees is so little, but maybe it can be done in a good way. I don't know. Actually seems like a great idea now, just that I'm a picky reviewer :(

oprypin avatar Jul 18 '23 16:07 oprypin

In case you are curious about the use case: https://github.com/frequenz-floss/frequenz-repo-config-python/blob/v0.x.x/tests/integration/test_cookiecutter_generation.py

(it's basically testing generation of templates using cookiecutter)

llucax avatar Aug 02 '23 07:08 llucax

For more context, I used also golden testing in Flutter, to test whole rendering of visual objects. In that case what you normally do is export the rendering of an app as a PNG and then compare the generated PNGs to make sure you didn't screw your interface when introducing some changes. Using YAML to store blobs doesn't seem very practical either, so this could be another use case for this.

llucax avatar Aug 02 '23 07:08 llucax

Check out this other project https://twitter.com/15r10nk/status/1720350727178965154

oprypin avatar Nov 09 '23 15:11 oprypin