1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 hatchling,
7 pytest,
8 black,
9 ruff,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "pytest-examples";
15 version = "0.0.18";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "pydantic";
20 repo = "pytest-examples";
21 tag = "v${version}";
22 hash = "sha256-ZnDl0B7/oLX6PANrqsWtVJwe4E/+7inCgOpo7oSeZlw=";
23 };
24
25 patches = [
26 (fetchpatch {
27 url = "https://github.com/pydantic/pytest-examples/pull/65/commits/60ae70d05ee345b38c2d2048d36b4a4545c98b6b.diff";
28 hash = "sha256-Rhrg0zVChwwa7Gk+WYrCu44VgUQmxLBeq8pWSF6Nzdo=";
29 })
30 ];
31
32 build-system = [
33 hatchling
34 ];
35
36 buildInputs = [ pytest ];
37
38 dependencies = [
39 black
40 ruff
41 ];
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 pythonImportsCheck = [ "pytest_examples" ];
46
47 disabledTests = [
48 # Fails with AssertionError because formatting is different than expected
49 "test_black_error"
50 "test_black_error_dot_space"
51 "test_black_error_multiline"
52 ];
53
54 disabledTestPaths = [
55 # assert 1 + 2 == 4
56 "tests/test_run_examples.py::test_run_example_ok_fail"
57 ];
58
59 meta = {
60 description = "Pytest plugin for testing examples in docstrings and markdown files";
61 homepage = "https://github.com/pydantic/pytest-examples";
62 changelog = "https://github.com/pydantic/pytest-examples/releases/tag/${src.tag}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ fab ];
65 };
66}