Skip to content

Commit 154ba71

Browse files
committed
improve snapshot ux
1 parent 13078b4 commit 154ba71

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/common/test_tools/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ def flagsmith_markers_marked(
8282
@pytest.fixture
8383
def snapshot(request: pytest.FixtureRequest) -> SnapshotFixture:
8484
for_update = request.config.getoption("--snapshot-update")
85+
snapshot_dir = request.path.parent / "snapshots"
86+
snapshot_dir.mkdir(exist_ok=True)
8587

8688
def _get_snapshot(name: str = "") -> Snapshot:
8789
snapshot_name = name or f"{request.node.name}.txt"
88-
snapshot_path = request.path.parent / f"snapshots/{snapshot_name}"
90+
snapshot_path = snapshot_dir / snapshot_name
8991
return Snapshot(snapshot_path, for_update=for_update)
9092

9193
return _get_snapshot

0 commit comments

Comments
 (0)