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

feat: detect unused snapshots despite xdist #901

Open epenet opened 1 month ago

epenet commented 1 month ago

Description

Improve xdist compatibility - with the ability to serialize/deserialize the report data. See https://github.com/home-assistant/core/pull/128162 for sample implementation

Related Issues

Known Limitations pytest-xdist support only partially exists. There is no issue when it comes to reads however when you attempt to run pytest --snapshot-update, if running with more than 1 process, the ability to detect unused snapshots is disabled. See https://github.com/syrupy-project/syrupy/issues/535 for more information. We welcome contributions to patch these known limitations.

Checklist

Additional Comments

No additional comments.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 87.09677% with 8 lines in your changes missing coverage. Please review.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #901      +/-   ##
==========================================
- Coverage   97.74%   97.34%   -0.40%     
==========================================
  Files          21       21              
  Lines        1596     1658      +62     
==========================================
+ Hits         1560     1614      +54     
- Misses         36       44       +8     
epenet commented 1 month ago

After running successfully on Home Assistant - it was decided to revert it because serialization/de-serialization of the report was taking too long. We may need to add an option so it only takes effect if --snapshot-update or --snapshot-details is set Or maybe add a new settting --snapshot-xdist-report See https://github.com/home-assistant/core/pull/129311