gentle-painting-24549
07/26/2023, 3:37 PM--update-snapshot
option to the pytest CLI. Now that we're on pants I'm unsure which mechanisms, targets, goals we would use instead. I can run ./pants test package/tests/test_example.py -- --update-snapshot
but the new snapshots I want to save are inside the sandbox. So how would I use my python_tests
targets to generate new resources
targets (which are ultimately Python files which contain the snapshots)?high-yak-85899
07/26/2023, 3:45 PMhigh-yak-85899
07/26/2023, 3:46 PMhigh-yak-85899
07/26/2023, 3:47 PMgentle-painting-24549
07/26/2023, 3:49 PMresource
targets for the tests to use.high-yak-85899
07/26/2023, 3:52 PMhigh-yak-85899
07/26/2023, 3:54 PMhappy-kitchen-89482
07/26/2023, 5:52 PMhappy-kitchen-89482
07/26/2023, 5:53 PMhappy-kitchen-89482
07/26/2023, 5:53 PMhappy-kitchen-89482
07/26/2023, 5:53 PMwitty-family-13337
07/26/2023, 6:14 PMgentle-painting-24549
07/26/2023, 6:30 PMpython_test
targets and move them out of the sandbox and into the repo so they can become resource
targets.
@witty-family-13337 it sounds like the helm snapshots are doing something similar? Depending on the testing plugin / config you're using these files could show up in folders with different naming conventions and could also be YAML, Python, or other types of files. I'm not familiar with helm very much but it sounds like snapshots are a supported tool by helm itself and not implemented as a third party plugin. This seems more convenient as the file naming pattern / format would be consistent.witty-family-13337
07/26/2023, 6:44 PMunittest
. In this plugin’s context, snapshots are YAML files that live in a folder with named __snapshot__
(no option to change it).
The implementation in Pants rests in 3 pilars:
1. Tailor: Being capable of detecting the existence of snapshot folders and generate resource
targets for them.
2. Dependency Inference: On the presence of resources
targets in a snapshot folder (relative to the test sources), then establish a dependency relationship between the test sources and the snapshot resources (the user should still be capable to explicitly negate that dependency like in other cases supported by Pants)
3. Generate Snapshots: This is a new goal that would trigger the generation of new or updates test snapshots. If new snapshots are generated, then a new tailor run may be needed to get the resources
targets generated again.witty-family-13337
07/26/2023, 6:48 PMwitty-family-13337
07/26/2023, 6:49 PMgentle-painting-24549
07/26/2023, 8:14 PMhappy-kitchen-89482
07/26/2023, 8:39 PMhappy-kitchen-89482
07/26/2023, 8:39 PMhappy-kitchen-89482
07/26/2023, 8:40 PM