summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-examples/default.nix
blob: 39e4fd28a34ced32e92be21cf25f998172182e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  hatchling,
  pytest,
  black,
  ruff,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pytest-examples";
  version = "0.0.18";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pydantic";
    repo = "pytest-examples";
    tag = "v${version}";
    hash = "sha256-ZnDl0B7/oLX6PANrqsWtVJwe4E/+7inCgOpo7oSeZlw=";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/pydantic/pytest-examples/pull/65/commits/60ae70d05ee345b38c2d2048d36b4a4545c98b6b.diff";
      hash = "sha256-Rhrg0zVChwwa7Gk+WYrCu44VgUQmxLBeq8pWSF6Nzdo=";
    })
  ];

  build-system = [
    hatchling
  ];

  buildInputs = [ pytest ];

  dependencies = [
    black
    ruff
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "pytest_examples" ];

  disabledTests = [
    # Fails with AssertionError because formatting is different than expected
    "test_black_error"
    "test_black_error_dot_space"
    "test_black_error_multiline"
  ];

  disabledTestPaths = [
    # assert 1 + 2 == 4
    "tests/test_run_examples.py::test_run_example_ok_fail"
  ];

  meta = {
    description = "Pytest plugin for testing examples in docstrings and markdown files";
    homepage = "https://github.com/pydantic/pytest-examples";
    changelog = "https://github.com/pydantic/pytest-examples/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}