diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index bc4da3eae855..2c23f1aa12f5 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -79,6 +79,7 @@ "stubs/pyflakes", "stubs/Pygments", "stubs/PyMySQL", + "stubs/pytest-snapshot", "stubs/python-crontab", "stubs/python-dateutil", "stubs/python-http-client", diff --git a/stubs/pytest-snapshot/@tests/stubtest_allowlist.txt b/stubs/pytest-snapshot/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stubs/pytest-snapshot/METADATA.toml b/stubs/pytest-snapshot/METADATA.toml new file mode 100644 index 000000000000..85fadd4f26cd --- /dev/null +++ b/stubs/pytest-snapshot/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.9.*" +upstream_repository = "https://github.com/joseph-roitman/pytest-snapshot" +requires = ["pytest"] diff --git a/stubs/pytest-snapshot/pytest_snapshot/__init__.pyi b/stubs/pytest-snapshot/pytest_snapshot/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stubs/pytest-snapshot/pytest_snapshot/plugin.pyi b/stubs/pytest-snapshot/pytest_snapshot/plugin.pyi new file mode 100644 index 000000000000..e139fad029fe --- /dev/null +++ b/stubs/pytest-snapshot/pytest_snapshot/plugin.pyi @@ -0,0 +1,27 @@ +import re +from collections.abc import Generator +from pathlib import Path +from types import TracebackType +from typing import Any + +import _pytest.config.argparsing +import pytest + +PARAMETRIZED_TEST_REGEX: re.Pattern[str] + +def pytest_addoption(parser: _pytest.config.argparsing.Parser) -> None: ... +@pytest.fixture +def snapshot(request: pytest.FixtureRequest) -> Generator[Snapshot, Any, None]: ... + +class Snapshot: + def __init__(self, snapshot_update: bool, allow_snapshot_deletion: bool, snapshot_dir: Path): ... + def __enter__(self): ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @property + def snapshot_dir(self) -> Path: ... + @snapshot_dir.setter + def snapshot_dir(self, value: str | Path) -> None: ... + def assert_match(self, value: str | bytes, snapshot_name: str | Path) -> None: ... + def assert_match_dir(self, dir_dict: dict[Any, Any], snapshot_dir_name: str | Path) -> None: ...