syrupy-project / syrupy

:pancakes: The sweeter pytest snapshot plugin
https://syrupy-project.github.io/syrupy/
Apache License 2.0
553 stars 36 forks source link

CLI option to update snapshots without running other tests #922

Open nolanbconaway opened 1 week ago

nolanbconaway commented 1 week ago

Is your feature request related to a problem? Please describe.

I am using syrupy in a few libraries, and I find myself in a common pattern in which I write a Makefile target like make snapshot-update which invokes pytest --snapshot-update. But the real intention behind that make target is not necessarily to run all the tests and update snapshots; but to update the snapshots only.

Describe the solution you'd like

I think it'd be a neat feature to support a pytest selector which isolates only the tests depending on the snapshot fixture; so that pytest --snapshot-update could be extended to only run tests with any snapshots.

Describe alternatives you've considered

It's not a big deal! I just run all my tests when i run updates. :smile:

Additional context