1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 flit-core,
8
9 # dependencies
10 attrs,
11 jsonschema,
12 nbclient,
13 nbdime,
14 nbformat,
15
16 # buildInputs
17 pytest,
18
19 # tests
20 black,
21 coverage,
22 ipykernel,
23 pytest-cov-stub,
24 pytest-regressions,
25 pytestCheckHook,
26 writableTmpDirAsHomeHook,
27 pythonAtLeast,
28}:
29
30buildPythonPackage rec {
31 pname = "pytest-notebook";
32 version = "0.10.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "chrisjsewell";
37 repo = "pytest-notebook";
38 tag = "v${version}";
39 hash = "sha256-LoK0wb7rAbVbgyURCbSfckWvJDef3tPY+7V4YU1IBRU=";
40 };
41
42 build-system = [
43 flit-core
44 ];
45
46 pythonRelaxDeps = [
47 "attrs"
48 "nbclient"
49 ];
50
51 dependencies = [
52 attrs
53 jsonschema
54 nbclient
55 nbdime
56 nbformat
57 ];
58
59 buildInputs = [ pytest ];
60
61 pythonImportsCheck = [ "pytest_notebook" ];
62
63 nativeCheckInputs = [
64 black
65 coverage
66 ipykernel
67 pytest-cov-stub
68 pytest-regressions
69 pytestCheckHook
70 writableTmpDirAsHomeHook
71 ];
72
73 disabledTests =
74 [
75 # AssertionError: FILES DIFFER:
76 "test_diff_to_string"
77
78 # pytest_notebook.execution.CoverageError: An error occurred while executing coverage start-up
79 # TypeError: expected str, bytes or os.PathLike object, not NoneType
80 "test_execute_notebook_with_coverage"
81 "test_regression_coverage"
82
83 # pytest_notebook.nb_regression.NBRegressionError
84 "test_regression_regex_replace_pass"
85 ]
86 ++ lib.optionals (pythonAtLeast "3.13") [
87 # AssertionError: FILES DIFFER:
88 "test_documentation"
89 ];
90
91 __darwinAllowLocalNetworking = true;
92
93 meta = {
94 changelog = "https://github.com/chrisjsewell/pytest-notebook/blob/${src.tag}/docs/source/changelog.md";
95 description = "Pytest plugin for regression testing and regenerating Jupyter Notebooks";
96 homepage = "https://github.com/chrisjsewell/pytest-notebook";
97 license = lib.licenses.bsd3;
98 maintainers = with lib.maintainers; [ dotlambda ];
99 };
100}