Skip to content

Commit 9513520

Browse files
committed
feat(tests): allow creating snapshot files
1 parent fe82830 commit 9513520

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/common/test_tools/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def __call__(self, name: str = "") -> "Snapshot": ...
2121
class Snapshot:
2222
def __init__(self, path: Path, for_update: bool) -> None:
2323
self.path = path
24-
self.content = open(path, encoding="utf-8").read()
24+
mode = "r" if not for_update else "w+"
25+
self.content = open(path, encoding="utf-8", mode=mode).read()
2526
self.for_update = for_update
2627

2728
def __eq__(self, other: object) -> bool:

0 commit comments

Comments
 (0)