summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-codspeed/default.nix
blob: 4b3eebde01195c085e3aed09c1795d8f06271a1a (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
73
74
75
76
77
78
{
  lib,
  buildPythonPackage,
  cffi,
  fetchFromGitHub,
  pytest-benchmark,
  pytest-cov-stub,
  pytest-xdist,
  pytest,
  pytestCheckHook,
  rich,
  semver,
  setuptools,
}:

let
  instrument-hooks = fetchFromGitHub {
    owner = "CodSpeedHQ";
    repo = "instrument-hooks";
    rev = "b003e5024d61cfb784d6ac6f3ffd7d61bf7b9ec9";
    hash = "sha256-JTSH4wOpOGJ97iV6sagiRUu8d3sKM2NJRXcB3NmozNQ=";
  };
in

buildPythonPackage rec {
  pname = "pytest-codspeed";
  version = "4.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "CodSpeedHQ";
    repo = "pytest-codspeed";
    tag = "v${version}";
    hash = "sha256-5fdG7AEiLD3ZZzU/7zBK0+LDacTZooyDUo+FefcE4uQ=";
  };

  postPatch = ''
    pushd src/pytest_codspeed/instruments/hooks
    rmdir instrument-hooks
    ln -nsf ${instrument-hooks} instrument-hooks
    popd
  '';

  build-system = [
    cffi
    setuptools
  ];

  buildInputs = [ pytest ];

  dependencies = [
    cffi
    rich
  ];

  optional-dependencies = {
    compat = [
      pytest-benchmark
      pytest-xdist
    ];
  };

  nativeCheckInputs = [
    semver
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "pytest_codspeed" ];

  meta = {
    description = "Pytest plugin to create CodSpeed benchmarks";
    homepage = "https://github.com/CodSpeedHQ/pytest-codspeed";
    changelog = "https://github.com/CodSpeedHQ/pytest-codspeed/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}