1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 pythonAtLeast,
7 fetchFromGitHub,
8 fetchpatch2,
9 setuptools,
10 setuptools-scm,
11 wheel,
12 py,
13 pytest,
14 pytestCheckHook,
15}:
16
17buildPythonPackage rec {
18 pname = "pytest-forked";
19 version = "1.6.0";
20
21 disabled = pythonOlder "3.7";
22
23 format = "pyproject";
24
25 src = fetchFromGitHub {
26 owner = "pytest-dev";
27 repo = "pytest-forked";
28 tag = "v${version}";
29 hash = "sha256-owkGwF5WQ17/CXwTsIYJ2AgktekRB4qhtsDxR0LCI/k=";
30 };
31
32 patches = [
33 (fetchpatch2 {
34 # https://github.com/pytest-dev/pytest-forked/actions
35 name = "pytest8-compat.patch";
36 url = "https://github.com/pytest-dev/pytest-forked/commit/b2742322d39ebda97d5170922520f3bb9c73f614.patch";
37 hash = "sha256-tTRW0p3tOotQMtjjJ6RUKdynsAnKRz0RAV8gAUHiNNA=";
38 })
39 ];
40
41 nativeBuildInputs = [
42 setuptools
43 setuptools-scm
44 wheel
45 ];
46
47 buildInputs = [ pytest ];
48
49 propagatedBuildInputs = [ py ];
50
51 nativeCheckInputs = [
52 py
53 pytestCheckHook
54 ];
55
56 disabledTests =
57 if (pythonAtLeast "3.12" && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then
58 [
59 # non reproducible test failure on hydra, works on community builder
60 # https://hydra.nixos.org/build/252537267
61 "test_xfail"
62 ]
63 else
64 null;
65
66 setupHook = ./setup-hook.sh;
67
68 meta = {
69 changelog = "https://github.com/pytest-dev/pytest-forked/blob/${src.rev}/CHANGELOG.rst";
70 description = "Run tests in isolated forked subprocesses";
71 homepage = "https://github.com/pytest-dev/pytest-forked";
72 license = lib.licenses.mit;
73 maintainers = with lib.maintainers; [ dotlambda ];
74 };
75}