summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-forked/default.nix
blob: 95e2f79415111250e9b0caafb83a82fac5a12ec5 (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
67
68
69
70
71
72
{
  lib,
  stdenv,
  buildPythonPackage,
  pythonAtLeast,
  fetchFromGitHub,
  fetchpatch2,
  setuptools,
  setuptools-scm,
  wheel,
  py,
  pytest,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pytest-forked";
  version = "1.6.0";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "pytest-dev";
    repo = "pytest-forked";
    tag = "v${version}";
    hash = "sha256-owkGwF5WQ17/CXwTsIYJ2AgktekRB4qhtsDxR0LCI/k=";
  };

  patches = [
    (fetchpatch2 {
      # https://github.com/pytest-dev/pytest-forked/actions
      name = "pytest8-compat.patch";
      url = "https://github.com/pytest-dev/pytest-forked/commit/b2742322d39ebda97d5170922520f3bb9c73f614.patch";
      hash = "sha256-tTRW0p3tOotQMtjjJ6RUKdynsAnKRz0RAV8gAUHiNNA=";
    })
  ];

  nativeBuildInputs = [
    setuptools
    setuptools-scm
    wheel
  ];

  buildInputs = [ pytest ];

  propagatedBuildInputs = [ py ];

  nativeCheckInputs = [
    py
    pytestCheckHook
  ];

  disabledTests =
    if (pythonAtLeast "3.12" && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then
      [
        # non reproducible test failure on hydra, works on community builder
        # https://hydra.nixos.org/build/252537267
        "test_xfail"
      ]
    else
      null;

  setupHook = ./setup-hook.sh;

  meta = {
    changelog = "https://github.com/pytest-dev/pytest-forked/blob/${src.rev}/CHANGELOG.rst";
    description = "Run tests in isolated forked subprocesses";
    homepage = "https://github.com/pytest-dev/pytest-forked";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}