From 479b66f01be54701e22f4ffad98a6e1f6a5583fd Mon Sep 17 00:00:00 2001 From: Frank Hoffmann <15r10nk-git@polarbit.de> Date: Tue, 27 Feb 2024 20:08:16 +0100 Subject: [PATCH 1/2] feat!: removed old --update-snapshots option --- inline_snapshot/pytest_plugin.py | 30 ------------------------------ tests/test_pytest_plugin.py | 22 +--------------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/inline_snapshot/pytest_plugin.py b/inline_snapshot/pytest_plugin.py index 93eb8385..af8b5f21 100644 --- a/inline_snapshot/pytest_plugin.py +++ b/inline_snapshot/pytest_plugin.py @@ -1,4 +1,3 @@ -import argparse from pathlib import Path import pytest @@ -34,16 +33,6 @@ def pytest_addoption(parser): help="disable snapshot logic", ) - # deprecated option - group.addoption( - "--update-snapshots", - action="store", - dest="inline_snapshot_deprecated", - default="none", - choices=("all", "failing", "new", "none"), - help=argparse.SUPPRESS, - ) - def pytest_configure(config): flags = config.option.inline_snapshot.split(",") @@ -58,30 +47,11 @@ def pytest_configure(config): _inline_snapshot._update_flags = _inline_snapshot.Flags(set(flags)) - old_flag = config.option.inline_snapshot_deprecated - snapshot_path = Path(config.rootpath) / ".inline-snapshot/external" _external.storage = _external.DiscStorage(snapshot_path) _config.config = _config.read_config(config.rootpath / "pyproject.toml") - if old_flag != "none": - msg_prefix = f"--update-snapshots={old_flag} is deprecated, please use " - - if _inline_snapshot._update_flags.change_something(): - raise pytest.UsageError(msg_prefix + "only --inline-snapshot") - - elif old_flag == "failing": - raise pytest.UsageError(msg_prefix + "--inline-snapshot=fix") - - elif old_flag == "new": - raise pytest.UsageError(msg_prefix + "--inline-snapshot=create") - - elif old_flag == "all": - raise pytest.UsageError(msg_prefix + "--inline-snapshot=create,fix") - else: - assert False - if _inline_snapshot._update_flags.change_something(): import sys diff --git a/tests/test_pytest_plugin.py b/tests/test_pytest_plugin.py index 96952634..fc492848 100644 --- a/tests/test_pytest_plugin.py +++ b/tests/test_pytest_plugin.py @@ -163,7 +163,7 @@ def test_a(): ) -def test_deprecated_option(project): +def test_disable_option(project): project.setup( """\ def test_a(): @@ -171,31 +171,11 @@ def test_a(): """ ) - result = project.run("--update-snapshots=failing") - assert result.stderr.str().strip() == snapshot( - "ERROR: --update-snapshots=failing is deprecated, please use --inline-snapshot=fix" - ) - - result = project.run("--update-snapshots=new") - assert result.stderr.str().strip() == snapshot( - "ERROR: --update-snapshots=new is deprecated, please use --inline-snapshot=create" - ) - - result = project.run("--update-snapshots=all") - assert result.stderr.str().strip() == snapshot( - "ERROR: --update-snapshots=all is deprecated, please use --inline-snapshot=create,fix" - ) - result = project.run("--inline-snapshot-disable", "--inline-snapshot=fix") assert result.stderr.str().strip() == snapshot( "ERROR: --inline-snapshot-disable can not be combined with other flags (fix)" ) - result = project.run("--update-snapshots=failing", "--inline-snapshot=fix") - assert result.stderr.str().strip() == snapshot( - "ERROR: --update-snapshots=failing is deprecated, please use only --inline-snapshot" - ) - def test_black_config(project): project.setup( From 80ef069361e856e36d8b41bdda152d8a06918e59 Mon Sep 17 00:00:00 2001 From: Frank Hoffmann <15r10nk-git@polarbit.de> Date: Tue, 27 Feb 2024 20:11:35 +0100 Subject: [PATCH 2/2] =?UTF-8?q?bump:=20version=200.6.1=20=E2=86=92=200.7.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ inline_snapshot/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fbae2a8..5650029a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.7.0 (2024-02-27) + +### Feat + +- removed old --update-snapshots option + ## v0.6.1 (2024-01-28) ### Fix diff --git a/inline_snapshot/__init__.py b/inline_snapshot/__init__.py index 8206cb32..88a4f40c 100644 --- a/inline_snapshot/__init__.py +++ b/inline_snapshot/__init__.py @@ -4,4 +4,4 @@ __all__ = ["snapshot", "external", "outsource"] -__version__ = "0.6.1" +__version__ = "0.7.0" diff --git a/pyproject.toml b/pyproject.toml index 0d6d3380..4b989ca7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ license = "MIT" name = "inline-snapshot" readme = "README.md" repository = "https://github.com/15r10nk/inline-snapshots" -version = "0.6.1" +version = "0.7.0" [tool.poetry.dependencies] asttokens = ">=2.0.5"