Skip to content

Commit 23e641b

Browse files
authored
Migrate to inline-snapshot for snapshot files (#62)
2 parents 739393c + c1ea6e6 commit 23e641b

42 files changed

Lines changed: 42 additions & 39 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ on:
1010

1111
jobs:
1212
lint:
13-
uses: George-Ogden/actions/.github/workflows/lint.yaml@v4.0.0
13+
uses: George-Ogden/actions/.github/workflows/lint.yaml@v4.0.1

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ permissions:
1111

1212
jobs:
1313
release:
14-
uses: George-Ogden/actions/.github/workflows/python-release.yaml@v4.0.0
14+
uses: George-Ogden/actions/.github/workflows/python-release.yaml@v4.0.1
1515
with:
1616
validation-code: "import mypy.version; from mypy_pytest_plugin import plugin; plugin(mypy.version.__version__)"

.github/workflows/test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
matrix:
1515
shard: [0, 1, 2]
1616
total-shards: [3]
17-
uses: George-Ogden/actions/.github/workflows/python-test.yaml@v4.0.0
17+
uses: George-Ogden/actions/.github/workflows/python-test.yaml@v4.0.1
1818
with:
1919
python-versions: "['3.12', '3.13', '3.14']"
2020
timeout-minutes: 15
21-
pytest-flags: -vv mypy_pytest_plugin -n auto --shard-id=${{ matrix.shard }} --num-shards=${{ matrix.total-shards }}
21+
pytest-flags: -vv mypy_pytest_plugin -n auto --shard-id=${{ matrix.shard }} --num-shards=${{ matrix.total-shards }} --inline-snapshot=disable
2222

2323
integration_tests:
24-
uses: George-Ogden/actions/.github/workflows/python-test.yaml@v3.2.0
24+
uses: George-Ogden/actions/.github/workflows/python-test.yaml@v4.0.1
2525
with:
2626
python-versions: "['3.12', '3.13', '3.14']"
2727
timeout-minutes: 10
28-
pytest-flags: -vv tests -n auto
28+
pytest-flags: -vv tests -n auto --inline-snapshot=disable

.mirror.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# DANGER: EDIT AT YOUR OWN RISK. Track this file in version control so that others can sync files correctly.
2-
- commit: ca4110b072cfbd98e49a45ec2071e466d2f7f27f
2+
- commit: 160787740d5a4289276696fe07ebd6609580e10e
33
files:
44
- .github/python-release.yaml
55
- .github/python-test.yaml

.pre-commit-config.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_stages: [pre-commit]
2-
default_install_hook_types: [pre-commit, commit-msg]
2+
default_install_hook_types: [pre-commit, prepare-commit-msg, commit-msg]
33

44
ci:
55
skip:
@@ -36,7 +36,7 @@ repos:
3636
args: [--severity=warning]
3737

3838
- repo: https://github.com/astral-sh/ruff-pre-commit/
39-
rev: v0.15.0
39+
rev: v0.15.2
4040
hooks:
4141
- id: ruff-check
4242
args: [--fix]
@@ -50,12 +50,17 @@ repos:
5050
- id: prettier
5151

5252
- repo: https://github.com/rhysd/actionlint/
53-
rev: v1.7.10
53+
rev: v1.7.11
5454
hooks:
5555
- id: actionlint
5656

57+
- repo: https://github.com/codespell-project/codespell
58+
rev: v2.4.1
59+
hooks:
60+
- id: codespell
61+
5762
- repo: https://github.com/George-Ogden/pre-commit-hooks/
58-
rev: v2.2.0
63+
rev: v2.3.0
5964
hooks:
6065
- id: check-merge-conflict
6166
- id: dbg-check
@@ -68,3 +73,4 @@ repos:
6873
args: [-r, requirements-dev.txt, --show-traceback]
6974
exclude: test_samples/
7075
- id: spell-check-commit-msgs
76+
- id: version-txt-auto-msg

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ strict_equality = true
99
exclude_gitignore = true
1010
plugins = plugin.py, mypy.plugins.proper_plugin
1111

12-
[pytest_snapshot.*,xdist.*]
12+
[xdist.*]
1313
ignore_missing_imports = true

mypy_pytest_plugin/argnames_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _check_duplicate_argnames(
6565

6666
def _check_duplicate_argnames_sequence(
6767
self, argnames: list[str], context: Context
68-
) -> None | list[str]:
68+
) -> list[str] | None:
6969
argname_counts = Counter(argnames)
7070
duplicates = [argname for argname, count in argname_counts.items() if count > 1]
7171
if duplicates:

mypy_pytest_plugin/checker_wrapper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CheckerWrapper(abc.ABC):
1717
@abc.abstractmethod
1818
def __init__(self) -> None: ...
1919

20-
def fail(self, msg: str, *, context: Context, code: ErrorCode, file: None | str = None) -> None:
20+
def fail(self, msg: str, *, context: Context, code: ErrorCode, file: str | None = None) -> None:
2121
self.checker.msg.fail(msg, context=context, code=code, file=file)
2222

2323
def note(self, msg: str, *, context: Context, code: ErrorCode | None) -> None:
@@ -55,7 +55,7 @@ def lookup_fullname[T](
5555
fullname: Fullname,
5656
*,
5757
context: Context | None = None,
58-
predicate: None | Callable[[Any], TypeGuard[T]] = None,
58+
predicate: Callable[[Any], TypeGuard[T]] | None = None,
5959
) -> tuple[MypyFile, T] | None: ...
6060

6161
@overload
@@ -64,15 +64,15 @@ def lookup_fullname(
6464
fullname: Fullname,
6565
*,
6666
context: Context | None = None,
67-
predicate: None | Callable[[Any], bool] = None,
67+
predicate: Callable[[Any], bool] | None = None,
6868
) -> tuple[MypyFile, Any] | None: ...
6969

7070
def lookup_fullname(
7171
self,
7272
fullname: Fullname,
7373
*,
7474
context: Context | None = None,
75-
predicate: None | Callable[[Any], bool] = None,
75+
predicate: Callable[[Any], bool] | None = None,
7676
) -> tuple[MypyFile, Any] | None:
7777
module_name, target = (Fullname(()), fullname)
7878
while target:
@@ -92,10 +92,10 @@ def _lookup_fullname_in_module[T](
9292
) -> T | None: ...
9393
@overload
9494
def _lookup_fullname_in_module(
95-
self, module: MypyFile, target: Fullname, *, predicate: None | Callable[[Any], bool]
95+
self, module: MypyFile, target: Fullname, *, predicate: Callable[[Any], bool] | None
9696
) -> Any | None: ...
9797
def _lookup_fullname_in_module(
98-
self, module: MypyFile, target: Fullname, *, predicate: None | Callable[[Any], bool]
98+
self, module: MypyFile, target: Fullname, *, predicate: Callable[[Any], bool] | None
9999
) -> Any | None:
100100
resource: Any = module
101101
for name in target:

mypy_pytest_plugin/fixture_manager_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def test_fixture_manager_default_fixture_module_names() -> None:
8080
"_pytest.subtests",
8181
"_pytest.tmpdir",
8282
"inline_snapshot.pytest_plugin",
83-
"pytest_snapshot.plugin",
8483
"xdist.plugin",
8584
]
8685
)
@@ -321,12 +320,12 @@ def test_fixture_manager_resolve_fixtures_request_builtins() -> None:
321320
_fixture_manager_resolve_fixtures_test_body(
322321
[
323322
(
324-
"pytest_snapshot.plugin",
323+
"xdist.plugin",
325324
"""
326325
import pytest
327326
328327
@pytest.fixture
329-
def snapshot() -> None:
328+
def worker() -> None:
330329
...
331330
""",
332331
),
@@ -345,12 +344,12 @@ def capsys() -> None:
345344
"""
346345
from typing import Any
347346
348-
def test_request(capsys: Any, snapshot: Any) -> None:
347+
def test_request(capsys: Any, worker: Any) -> None:
349348
...
350349
""",
351350
),
352351
],
353-
dict(capsys=["_pytest.capture.capsys"], snapshot=["pytest_snapshot.plugin.snapshot"]),
352+
dict(capsys=["_pytest.capture.capsys"], worker=["xdist.plugin.worker"]),
354353
)
355354

356355

@@ -525,7 +524,7 @@ def _fixture_manager_resolve_autouse_fixtures_test_body(
525524
isinstance(decorator := node.node, Decorator)
526525
and (fixture := Fixture.from_decorator(decorator, checker)) is not None
527526
):
528-
overrides[(module_name, name)] = fixture.as_fixture_type(
527+
overrides[module_name, name] = fixture.as_fixture_type(
529528
decorator=decorator, checker=checker
530529
)
531530
if autouse_node is not None:

mypy_pytest_plugin/object_patch_call_checker_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def foo[T](target: Any, attribute: str, test: T, *, extra_arg: int = 0) -> int:
6666

6767

6868
def _attribute_type_test_body(
69-
defs: str, attribute: str, *, errors: None | list[str] = None
69+
defs: str, attribute: str, *, errors: list[str] | None = None
7070
) -> None:
7171
parse_result = parse(defs)
7272
checker = parse_result.checker

0 commit comments

Comments
 (0)