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 # AssertionError: FILES DIFFER:
75 "test_diff_to_string"
76
77 # pytest_notebook.execution.CoverageError: An error occurred while executing coverage start-up
78 # TypeError: expected str, bytes or os.PathLike object, not NoneType
79 "test_execute_notebook_with_coverage"
80 "test_regression_coverage"
81
82 # pytest_notebook.nb_regression.NBRegressionError
83 "test_regression_regex_replace_pass"
84 ]
85 ++ lib.optionals (pythonAtLeast "3.13") [
86 # AssertionError: FILES DIFFER:
87 "test_documentation"
88 ];
89
90 __darwinAllowLocalNetworking = true;
91
92 meta = {
93 changelog = "https://github.com/chrisjsewell/pytest-notebook/blob/${src.tag}/docs/source/changelog.md";
94 description = "Pytest plugin for regression testing and regenerating Jupyter Notebooks";
95 homepage = "https://github.com/chrisjsewell/pytest-notebook";
96 license = lib.licenses.bsd3;
97 maintainers = with lib.maintainers; [ dotlambda ];
98 };
99}