1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 jinja2,
11 pytest,
12 rich,
13 syrupy,
14 textual,
15}:
16
17buildPythonPackage rec {
18 pname = "pytest-textual-snapshot";
19 version = "1.1.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "Textualize";
24 repo = "pytest-textual-snapshot";
25 tag = "v${version}";
26 hash = "sha256-ItwwaODnlya/T0Fk5DOPRLoBOwkUN5wq69cELuvy/Js=";
27 };
28
29 # The script looks for `resources/snapshot_report_template.jinja2` in the parent folder which
30 # is lib/python3.X/site-packages
31 # Let's avoid to have a random 'resources' folder in the PYTHONPATH.
32 # Instead, we move this `resources` folder in `$out/share` (see postInstall below) and patch the
33 # path in the script.
34 postPatch = ''
35 substituteInPlace pytest_textual_snapshot.py \
36 --replace-fail \
37 "this_file_path.parent" \
38 "Path('$out/share/pytest-textual-snapshot/')"
39 '';
40
41 build-system = [ poetry-core ];
42
43 dependencies = [
44 jinja2
45 pytest
46 rich
47 syrupy
48 textual
49 ];
50
51 pythonRelaxDeps = [
52 "syrupy"
53 ];
54
55 # Module has no tests
56 doCheck = false;
57
58 pythonImportsCheck = [ "pytest_textual_snapshot" ];
59
60 postInstall = ''
61 mkdir -p $out/share/pytest-textual-snapshot/
62 cp -r resources $out/share/pytest-textual-snapshot/
63 '';
64
65 meta = {
66 description = "Snapshot testing for Textual applications";
67 homepage = "https://github.com/Textualize/pytest-textual-snapshot";
68 changelog = "https://github.com/Textualize/pytest-textual-snapshot/releases/tag/v${version}";
69 license = lib.licenses.mit;
70 maintainers = with lib.maintainers; [ fab ];
71 };
72}