dev-python/pytest-textual-snapshot: new package, add 1.1.0

Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
Florian Albrechtskirchinger
2026-03-27 03:18:28 +01:00
parent 7bb12027c2
commit b433e818df
4 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST pytest_textual_snapshot-1.1.0.tar.gz 11391 BLAKE2B fc82f23e6e1eebd093694eba8fc419269dc88c9466dc601501ce346f4749f517d506aea977a3887f9cdf3cd60c87a845cea74eb7eb35d03607af22a8fa7890af SHA512 df667fc68b69ebe92ad669621203be0f89d0ec25c0a203b12a732cc56bd7a366f9ea24496bf9d3abceafa524cde506e7025deeb3d92f61d9e278ed56f8cf979e

View File

@@ -0,0 +1,29 @@
diff --git a/pytest_textual_snapshot.py b/pytest_textual_snapshot.py
index 44c5fd4..902a002 100644
--- a/pytest_textual_snapshot.py
+++ b/pytest_textual_snapshot.py
@@ -31,12 +31,12 @@ if TYPE_CHECKING:
class SVGImageExtension(SingleFileSnapshotExtension):
- _file_extension = "svg"
+ file_extension = "svg"
_write_mode = WriteMode.TEXT
- def _read_snapshot_data_from_location(self, *args, **kwargs) -> Optional["SerializableData"]:
+ def read_snapshot_data_from_location(self, *args, **kwargs) -> Optional["SerializableData"]:
"""Normalize SVG data right after they are loaded from persistent storage."""
- data = super()._read_snapshot_data_from_location(*args, **kwargs)
+ data = super().read_snapshot_data_from_location(*args, **kwargs)
if data is not None:
data = normalize_svg(data)
return data
@@ -305,6 +305,8 @@ def retrieve_svg_diffs(
pass_count = 0
n = 0
+ if not Path(tempdir.name).exists():
+ return diffs, pass_count
for data_path in Path(tempdir.name).iterdir():
(
passed,

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>falbrechtskirchinger@gmail.com</email>
<name>Florian Albrechtskirchinger</name>
</maintainer>
<upstream>
<remote-id type="pypi">pytest-textual-snapshot</remote-id>
<remote-id type="github">Textualize/pytest-textual-snapshot</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,44 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=poetry
PYTHON_COMPAT=( python3_{12..14} )
inherit distutils-r1 pypi
DESCRIPTION="Snapshot testing for Textual apps"
HOMEPAGE="
https://github.com/Textualize/pytest-textual-snapshot
https://pypi.org/project/pytest-textual-snapshot/
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
RDEPEND="
>=dev-python/jinja2-3.0.0[${PYTHON_USEDEP}]
>=dev-python/pytest-8.0.0[${PYTHON_USEDEP}]
>=dev-python/rich-12.0.0[${PYTHON_USEDEP}]
>=dev-python/syrupy-5.0.0[${PYTHON_USEDEP}]
>=dev-python/textual-0.28.0[${PYTHON_USEDEP}]
"
PATCHES=(
"${FILESDIR}/${PN}-1.1.0-syrupy-5-compat.patch"
)
src_prepare() {
distutils-r1_src_prepare
# Convert to proper Python package
mkdir pytest_textual_snapshot || die
mv pytest_textual_snapshot.py pytest_textual_snapshot/__init__.py || die
mv resources pytest_textual_snapshot/ || die
sed -i 's|"resources/\*\*/\*"|"pytest_textual_snapshot/resources/\*\*/\*"|' \
pyproject.toml || die
}