python312Packages.pytest-textual-snapshot: install resources

This commit is contained in:
Gutyina Gergő
2025-03-13 18:10:04 +01:00
parent 1e95f5e24c
commit f2e350b5b3
@@ -28,6 +28,17 @@ buildPythonPackage rec {
nativeBuildInputs = [ poetry-core ];
buildInputs = [ pytest ];
# The script looks for `resources/snapshot_report_template.jinja2` in the parent folder which
# is lib/python3.X/site-packages
# Let's avoid to have a random 'resources' folder in the PYTHONPATH.
# Instead, we move this `resources` folder in `$out/share` (see postInstall below) and patch the
# path in the script.
postPatch = ''
substituteInPlace pytest_textual_snapshot.py \
--replace-fail \
"this_file_path.parent" \
"Path('$out/share/pytest-textual-snapshot/')"
'';
propagatedBuildInputs = [
jinja2
@@ -45,6 +56,11 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pytest_textual_snapshot" ];
postInstall = ''
mkdir -p $out/share/pytest-textual-snapshot/
cp -r resources $out/share/pytest-textual-snapshot/
'';
meta = with lib; {
description = "Snapshot testing for Textual applications";
homepage = "https://github.com/Textualize/pytest-textual-snapshot";