Skip to content

Commit 0251599

Browse files
author
Noah
authored
feat: change update opt to conform to snapshot test, close #29 (#32)
1 parent 35b73c0 commit 0251599

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [TODO]
8-
9-
- [docs] create a logo
10-
- [docs] fill out project maturity card
11-
- [feat] cli option to remove obsolete snapshots from within snapshot file
12-
- [feat] support rich diffs for large snapshots
13-
- [chore] setup tox for python 3.6 -> 3.8 support
14-
- [chore] publish package
15-
167
## [Unreleased]
178

18-
- [feat] support --update-snapshots cli flag to write snapshots
9+
- [feat] support --snapshot-update cli flag to write snapshots
1910
- [feat] support custom plugins for writing snapshots, inc. image plugin

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_foo(snapshot):
4545
when you run `pytest`, the above test should fail due to a missing snapshot. Re-run pytest with the update snapshots flag like so:
4646

4747
```shell
48-
pytest --update-snapshots
48+
pytest --snapshot-update
4949
```
5050

5151
A snapshot file should be generated under a `__snapshots__` directory in the same directory as `test_file.py`. The `__snapshots__` directory and all its children should be committed along with your test code.

src/syrupy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def pytest_addoption(parser: Any) -> None:
1111
"""Exposes snapshot plugin configuration to pytest."""
1212
group = parser.getgroup("syrupy")
1313
group.addoption(
14-
"--update-snapshots",
14+
"--snapshot-update",
1515
action="store_true",
1616
default=False,
1717
dest="update_snapshots",

src/syrupy/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def finish(self) -> None:
9898
else:
9999
self.add_report_line(
100100
gettext(
101-
"Re-run pytest with --update-snapshots to delete the snapshots."
101+
"Re-run pytest with --snapshot-update to delete the snapshots."
102102
)
103103
)
104104

tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def lint(ctx, fix=False):
2929

3030

3131
@task
32-
def test(ctx, update_snapshots=False, verbose=False):
32+
def test(ctx, snapshot_update=False, verbose=False):
3333
ctx.run(
3434
"python -m pytest ."
3535
f"{' -s' if verbose else ''}"
36-
f"{' --update-snapshots' if update_snapshots else ''}",
36+
f"{' --snapshot-update' if snapshot_update else ''}",
3737
env={"PYTHONPATH": "./src"},
3838
pty=True,
3939
)

0 commit comments

Comments
 (0)