Open
Description
When using @pytest.mark.parametrize
with the ids
argument, snapshots are saved in alphabetical order of ids
instead of in the declared order. This makes snapshots harder to read, especially when there are many parametrisations and they are in some logical order (e.g. from simple to complex)
To reproduce
With a simple parameterised test setup such as
@pytest.mark.parametrize(
argnames=("input"),
argvalues=[
("test_b"),
("test_a"),
],
ids=["b", "a"],
)
def test_input(input: str, snapshot: SnapshotAssertion):
assert input == snapshot
syrupy will save the snapshots for these tests as
# name: test_input[a]
'test_a'
# ---
# name: test_input[b]
'test_b'
# ---
Expected behavior
I would expect that syrupy should save the snapshots for these tests as
# name: test_input[b]
'test_b'
# ---
# name: test_input[a]
'test_a'
# ---
Should this be the intended behaviour? If so, I'm happy to do the PR :)
Environment (please complete the following information):
- OS: Fedora 40
- Syrupy Version: 4.8.2
- Python Version: 3.12.9